summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2015-06-18 13:52:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2015-06-18 13:52:52 (GMT)
commit7fdb38eb6f07c3b24879885227993479849f107f (patch)
tree51263069709d2a9c63e28a8b1f891b21c2dda635 /tools
parent4878a00ac2f791d14b1ecf65f83d0c125a93b4fa (diff)
downloadhdf5-7fdb38eb6f07c3b24879885227993479849f107f.zip
hdf5-7fdb38eb6f07c3b24879885227993479849f107f.tar.gz
hdf5-7fdb38eb6f07c3b24879885227993479849f107f.tar.bz2
[svn-r27239] Add function prototype for local function
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5tools_str.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index cd1bec8..05a7dfb 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -48,6 +48,7 @@
static char *h5tools_escape(char *s, 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);
+void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx);
/*-------------------------------------------------------------------------
* Function: h5tools_str_close
@@ -144,16 +145,16 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...)
nchars = HDvsnprintf(str->s + str->len, avail, fmt, ap);
HDva_end(ap);
- /* Note: HDvsnprintf() behaves differently on Windows as Unix, when
- * buffer is smaller than source string. On Unix, this function
- * returns length of the source string and copy string upto the
- * buffer size with NULL at the end of the buffer. However on
- * Windows with the same condition, this function returns -1 and
+ /* Note: HDvsnprintf() behaves differently on Windows as Unix, when
+ * buffer is smaller than source string. On Unix, this function
+ * returns length of the source string and copy string upto the
+ * buffer size with NULL at the end of the buffer. However on
+ * Windows with the same condition, this function returns -1 and
* doesn't add NULL at the end of the buffer.
* Because of this different return results, the strlen of the new string
* is used to handle when HDvsnprintf() returns -1 on Windows due
* to lack of buffer size, so try one more time after realloc more
- * buffer size before return NULL.
+ * buffer size before return NULL.
*/
if (nchars < 0) {
/* failure, such as bad format */
@@ -277,7 +278,7 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
if (HDstrchr(fmt, '%')) {
size_t n = sizeof(_temp);
if (str->len - start + 1 > n) {
- n = str->len - start + 1;
+ n = str->len - start + 1;
temp = (char*)HDmalloc(n);
HDassert(temp);
}
@@ -729,12 +730,12 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info,
*
* PVN, 28 March 2006
* added H5T_NATIVE_LDOUBLE case
- *
+ *
* Raymond Lu, 2011-09-01
* CLANG compiler complained about the line (about 800):
* tempint = (tempint >> packed_data_offset) & packed_data_mask;
- * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is
- * 32-bit or more. For every kind of native integers, I changed the code
+ * The right shift may cause undefined behavior if PACKED_DATA_OFFSET is
+ * 32-bit or more. For every kind of native integers, I changed the code
* to make it zero if PACKED_DATA_OFFSET is greater than or equal to the
* size of integer.
*-------------------------------------------------------------------------
@@ -1435,37 +1436,37 @@ h5tools_str_is_zero(const void *_mem, size_t size)
*
* Purpose: replace all occurrences of substring.
*
- * Return: char *
+ * Return: char *
*
* Programmer: Peter Cao
* March 8, 2012
*
* Notes:
- * Applications need to call free() to free the memoery allocated for
- * the return string
+ * Applications need to call free() to free the memoery allocated for
+ * the return string
*
*-------------------------------------------------------------------------
*/
char *
h5tools_str_replace ( const char *string, const char *substr, const char *replacement )
{
- char *tok = NULL;
- char *newstr = NULL;
- char *oldstr = NULL;
- char *head = NULL;
-
- if ( substr == NULL || replacement == NULL )
- return HDstrdup (string);
-
- newstr = HDstrdup (string);
- head = newstr;
- while ( (tok = HDstrstr ( head, substr ))){
- oldstr = newstr;
- newstr = HDmalloc ( HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) + 1 );
+ char *tok = NULL;
+ char *newstr = NULL;
+ char *oldstr = NULL;
+ char *head = NULL;
+
+ if ( substr == NULL || replacement == NULL )
+ return HDstrdup (string);
+
+ newstr = HDstrdup (string);
+ head = newstr;
+ while ( (tok = HDstrstr ( head, substr ))){
+ oldstr = newstr;
+ newstr = HDmalloc ( HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) + 1 );
if ( newstr == NULL ){
- HDfree (oldstr);
- return NULL;
+ HDfree (oldstr);
+ return NULL;
}
HDmemcpy ( newstr, oldstr, tok - oldstr );
HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) );
@@ -1475,6 +1476,6 @@ h5tools_str_replace ( const char *string, const char *substr, const char *replac
head = newstr + (tok - oldstr) + HDstrlen( replacement );
HDfree (oldstr);
}
-
+
return newstr;
}