X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flibpspp%2Fstr.h;h=cd7cdb05ad754f7d2cc9697e8c0dcad322519b8d;hb=74fc00cc0eb769ab61141d290490037ba040f63a;hp=6f34c200d054d59c3da3f453db211d198fd798fe;hpb=b990f5c31bc831e588a86f9f4826387c6843c989;p=pspp-builds.git diff --git a/src/libpspp/str.h b/src/libpspp/str.h index 6f34c200..cd7cdb05 100644 --- a/src/libpspp/str.h +++ b/src/libpspp/str.h @@ -61,6 +61,8 @@ void str_copy_trunc (char *, size_t, const char *); void str_copy_buf_trunc (char *, size_t, const char *, size_t); void str_uppercase (char *); void str_lowercase (char *); + +char *spprintf (char *dst, const char *format, ...); /* Fixed-length strings. */ struct fixed_string @@ -117,7 +119,7 @@ struct string #define DS_INITIALIZER {NULL, 0, 0} /* Constructors, destructors. */ -void ds_init (struct string *, size_t); +void ds_init (struct string *); void ds_init_substring (struct string *, const struct string *src, size_t start, size_t cnt); void ds_create (struct string *, const char *); @@ -144,7 +146,9 @@ int ds_ltrim_spaces (struct string *); void ds_trim_spaces (struct string *); bool ds_chomp (struct string *, char); bool ds_separate (const struct string *src, struct string *token, - const char *delimiters, int *save_idx); + const char *delimiters, size_t *save_idx); +bool ds_tokenize (const struct string *src, struct string *token, + const char *delimiters, size_t *save_idx); /* Inspectors. */ bool ds_is_empty (const struct string *); @@ -171,6 +175,7 @@ void ds_concat (struct string *, const char *, size_t); void ds_vprintf (struct string *st, const char *, va_list); void ds_printf (struct string *, const char *, ...) PRINTF_FORMAT (2, 3); +char *ds_append_uninit (struct string *st, size_t incr); #if __GNUC__ > 1 extern inline void @@ -200,25 +205,4 @@ ds_end (const struct string *st) } #endif -#define nsprintf sprintf -#define nvsprintf vsprintf - -/* Formats FORMAT into DST, as with sprintf(), and returns the - address of the terminating null written to DST. */ -static inline char * -spprintf (char *dst, const char *format, ...) -{ - va_list args; - int count; - - va_start (args, format); - count = nvsprintf (dst, format, args); - va_end (args); - - return dst + count; -} - - - - #endif /* str_h */