aboutsummaryrefslogtreecommitdiff
path: root/src/pj_internal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pj_internal.c')
-rw-r--r--src/pj_internal.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/src/pj_internal.c b/src/pj_internal.c
index 6bb33d64..4dbcfbd4 100644
--- a/src/pj_internal.c
+++ b/src/pj_internal.c
@@ -148,56 +148,6 @@ void proj_context_inherit (PJ *parent, PJ *child) {
-/**************************************************************************************/
-size_t pj_strlcpy(char *dst, const char *src, size_t dsize) {
-/***************************************************************************************
- Copy src to string dst of size siz. At most siz-1 characters
- will be copied. Always NUL terminates (unless siz == 0).
- Returns strlen(src); if retval >= siz, truncation occurred.
-
- *
- * Copyright (c) 1998, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
-
- Source: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.c
-
-***************************************************************************************/
- const char *osrc = src;
- size_t nleft = dsize;
-
- /* Copy as many bytes as will fit. */
- if (nleft != 0) {
- while (--nleft != 0) {
- if ((*dst++ = *src++) == '\0')
- break;
- }
- }
-
- /* Not enough room in dst, add NUL and traverse rest of src. */
- if (nleft == 0) {
- if (dsize != 0)
- *dst = '\0'; /* NUL-terminate dst */
- while (*src++)
- ;
- }
-
- return(src - osrc - 1); /* count does not include NUL */
-}
-
-
-
/*****************************************************************************/
char *pj_chomp (char *c) {
/******************************************************************************
@@ -261,7 +211,9 @@ consuming their surrounding whitespace.
/* Eliminate prefix '+', only if preceeded by whitespace */
/* (i.e. keep it in 1.23e+08) */
- if ((i > 0) && ('+'==c[j]) && isspace (c[i]))
+ if ((i > 0) && ('+'==c[j]) && ws)
+ c[j] = ' ';
+ if ((i==0) && ('+'==c[j]))
c[j] = ' ';
if (isspace (c[j]) || ';'==c[j]) {