diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 17 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.h | 3 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 1 |
3 files changed, 21 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 4eed92a92f9..ac0325f9d60 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -2069,6 +2069,23 @@ skipwhite (char **s) (*s)++; } +void +gf_strTrim (char **s) +{ + char *end = NULL; + + end = *s + strlen(*s) - 1; + while (end > *s && isspace ((unsigned char)*end)) + end--; + + *(end+1) = '\0'; + + while (isspace (**s)) + (*s)++; + + return; +} + char * nwstrtail (char *str, char *pattern) { diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 89f7927aae1..c7f9fd58cc8 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -951,4 +951,7 @@ get_struct_variable (int mem_num, gf_gsync_status_t *sts_val); char * gf_strncpy (char *dest, const char *src, const size_t dest_size); +void +gf_strTrim (char **s); + #endif /* _COMMON_UTILS_H */ diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 613c18ed3e9..a515caec3e9 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -677,6 +677,7 @@ gf_string2uint64 gf_string2uint_base10 gf_strip_whitespace gf_strncpy +gf_strTrim gf_strstr gf_thread_cleanup_xint gf_thread_create |