From: Fabian Keil Date: Sat, 24 Nov 2012 13:58:17 +0000 (+0000) Subject: Move string_move() into miscutil.c and make it extern X-Git-Tag: v_3_0_20~167 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=8a8d5061c4646c704b2f247225ccb6cf80561bc2 Move string_move() into miscutil.c and make it extern It's not really a parser. --- diff --git a/miscutil.c b/miscutil.c index bbfba611..f04344c2 100644 --- a/miscutil.c +++ b/miscutil.c @@ -1,4 +1,4 @@ -const char miscutil_rcs[] = "$Id: miscutil.c,v 1.76 2012/03/09 17:55:50 fabiankeil Exp $"; +const char miscutil_rcs[] = "$Id: miscutil.c,v 1.77 2012/07/23 12:41:59 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/miscutil.c,v $ @@ -524,6 +524,31 @@ char *string_toupper(const char *string) } +/********************************************************************* + * + * Function : string_move + * + * Description : memmove wrapper to move the last part of a string + * towards the beginning, overwriting the part in + * the middle. strlcpy() can't be used here as the + * strings overlap. + * + * Parameters : + * 1 : dst = Destination to overwrite + * 2 : src = Source to move. + * + * Returns : N/A + * + *********************************************************************/ +void string_move(char *dst, char *src) +{ + assert(dst < src); + + /* +1 to copy the terminating nul as well. */ + memmove(dst, src, strlen(src)+1); +} + + /********************************************************************* * * Function : bindup diff --git a/miscutil.h b/miscutil.h index bf35238c..6c51ee95 100644 --- a/miscutil.h +++ b/miscutil.h @@ -1,6 +1,6 @@ #ifndef MISCUTIL_H_INCLUDED #define MISCUTIL_H_INCLUDED -#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.35 2012/03/04 11:52:45 fabiankeil Exp $" +#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.36 2012/07/23 12:41:59 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/miscutil.h,v $ @@ -60,8 +60,9 @@ extern int strncmpic(const char *s1, const char *s2, size_t n); extern jb_err string_append(char **target_string, const char *text_to_append); extern jb_err string_join (char **target_string, char *text_to_append); - extern char *string_toupper(const char *string); +extern void string_move(char *dst, char *src); + extern char *chomp(char *string); extern char *bindup(const char *string, size_t len); diff --git a/parsers.c b/parsers.c index 2f3b4f42..a785d824 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.264 2012/11/11 12:41:12 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.265 2012/11/24 13:57:30 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -738,31 +738,6 @@ jb_err decompress_iob(struct client_state *csp) #endif /* defined(FEATURE_ZLIB) */ -/********************************************************************* - * - * Function : string_move - * - * Description : memmove wrapper to move the last part of a string - * towards the beginning, overwriting the part in - * the middle. strlcpy() can't be used here as the - * strings overlap. - * - * Parameters : - * 1 : dst = Destination to overwrite - * 2 : src = Source to move. - * - * Returns : N/A - * - *********************************************************************/ -static void string_move(char *dst, char *src) -{ - assert(dst < src); - - /* +1 to copy the terminating nul as well. */ - memmove(dst, src, strlen(src)+1); -} - - /********************************************************************* * * Function : normalize_lws