[svn-r27238] Add function prototype for local function

This commit is contained in:
Allen Byrne 2015-06-18 08:52:35 -05:00
parent f30ab55f41
commit cf7c5123cb

View File

@ -48,6 +48,7 @@
static char *h5tools_escape(char *s, size_t size); static char *h5tools_escape(char *s, size_t size);
static hbool_t h5tools_str_is_zero(const void *_mem, size_t size); static hbool_t h5tools_str_is_zero(const void *_mem, size_t size);
static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch); static void h5tools_print_char(h5tools_str_t *str, const h5tool_format_t *info, char ch);
void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx);
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function: h5tools_str_close * Function: h5tools_str_close
@ -1385,23 +1386,23 @@ h5tools_str_is_zero(const void *_mem, size_t size)
char * char *
h5tools_str_replace ( const char *string, const char *substr, const char *replacement ) h5tools_str_replace ( const char *string, const char *substr, const char *replacement )
{ {
char *tok = NULL; char *tok = NULL;
char *newstr = NULL; char *newstr = NULL;
char *oldstr = NULL; char *oldstr = NULL;
char *head = NULL; char *head = NULL;
if ( substr == NULL || replacement == NULL ) if ( substr == NULL || replacement == NULL )
return HDstrdup (string); return HDstrdup (string);
newstr = HDstrdup (string); newstr = HDstrdup (string);
head = newstr; head = newstr;
while ( (tok = HDstrstr ( head, substr ))){ while ( (tok = HDstrstr ( head, substr ))){
oldstr = newstr; oldstr = newstr;
newstr = HDmalloc ( HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) + 1 ); newstr = HDmalloc ( HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) + 1 );
if ( newstr == NULL ){ if ( newstr == NULL ){
HDfree (oldstr); HDfree (oldstr);
return NULL; return NULL;
} }
HDmemcpy ( newstr, oldstr, tok - oldstr ); HDmemcpy ( newstr, oldstr, tok - oldstr );
HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) ); HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) );