Lines Matching refs:ss
273 splitbuf_grow (struct splitbuf *ss) in splitbuf_grow() argument
275 idx_t old_half_alloc = ss->half_alloc; in splitbuf_grow()
276 idx_t string_bytes = (intptr_t) ss->argv[ss->argc]; in splitbuf_grow()
277 ss->argv = xpalloc (ss->argv, &ss->half_alloc, 1, in splitbuf_grow()
278 MIN (INT_MAX, IDX_MAX), 2 * sizeof *ss->argv); in splitbuf_grow()
279 memmove (ss->argv + ss->half_alloc, ss->argv + old_half_alloc, string_bytes); in splitbuf_grow()
284 splitbuf_append_byte (struct splitbuf *ss, char c) in splitbuf_append_byte() argument
286 idx_t string_bytes = (intptr_t) ss->argv[ss->argc]; in splitbuf_append_byte()
287 if (ss->half_alloc * sizeof *ss->argv <= string_bytes) in splitbuf_append_byte()
288 splitbuf_grow (ss); in splitbuf_append_byte()
289 ((char *) (ss->argv + ss->half_alloc))[string_bytes] = c; in splitbuf_append_byte()
290 ss->argv[ss->argc] = (char *) (intptr_t) (string_bytes + 1); in splitbuf_append_byte()
296 check_start_new_arg (struct splitbuf *ss) in check_start_new_arg() argument
298 if (ss->sep) in check_start_new_arg()
300 splitbuf_append_byte (ss, '\0'); in check_start_new_arg()
301 int argc = ss->argc; in check_start_new_arg()
302 if (ss->half_alloc <= argc + ss->extra_argc + 1) in check_start_new_arg()
303 splitbuf_grow (ss); in check_start_new_arg()
304 ss->argv[argc + 1] = ss->argv[argc]; in check_start_new_arg()
305 ss->argc = argc + 1; in check_start_new_arg()
306 ss->sep = false; in check_start_new_arg()
313 splitbuf_finishup (struct splitbuf *ss) in splitbuf_finishup() argument
315 int argc = ss->argc; in splitbuf_finishup()
316 char **argv = ss->argv; in splitbuf_finishup()
317 char *stringbase = (char *) (ss->argv + ss->half_alloc); in splitbuf_finishup()
352 struct splitbuf ss; in build_argv() local
353 ss.argv = xnmalloc (extra_argc + 2, 2 * sizeof *ss.argv); in build_argv()
354 ss.argc = 1; in build_argv()
355 ss.half_alloc = extra_argc + 2; in build_argv()
356 ss.extra_argc = extra_argc; in build_argv()
357 ss.sep = true; in build_argv()
358 ss.argv[ss.argc] = 0; in build_argv()
373 check_start_new_arg (&ss); in build_argv()
381 check_start_new_arg (&ss); in build_argv()
389 ss.sep = true; in build_argv()
394 if (!ss.sep) in build_argv()
416 ss.sep = true; in build_argv()
460 check_start_new_arg (&ss); in build_argv()
463 splitbuf_append_byte (&ss, *v); in build_argv()
473 check_start_new_arg (&ss); in build_argv()
474 splitbuf_append_byte (&ss, newc); in build_argv()
482 splitbuf_append_byte (&ss, '\0'); in build_argv()
483 *argc = ss.argc; in build_argv()
484 return splitbuf_finishup (&ss); in build_argv()