Lines Matching refs:gs
59 struct gstr gs; in str_new() local
60 gs.s = malloc(sizeof(char) * 64); in str_new()
61 gs.len = 16; in str_new()
62 strcpy(gs.s, "\0"); in str_new()
63 return gs; in str_new()
69 struct gstr gs; in str_assign() local
70 gs.s = strdup(s); in str_assign()
71 gs.len = strlen(s) + 1; in str_assign()
72 return gs; in str_assign()
76 void str_free(struct gstr *gs) in str_free() argument
78 if (gs->s) in str_free()
79 free(gs->s); in str_free()
80 gs->s = NULL; in str_free()
81 gs->len = 0; in str_free()
85 void str_append(struct gstr *gs, const char *s) in str_append() argument
87 size_t l = strlen(gs->s) + strlen(s) + 1; in str_append()
88 if (l > gs->len) { in str_append()
89 gs->s = realloc(gs->s, l); in str_append()
90 gs->len = l; in str_append()
92 strcat(gs->s, s); in str_append()
96 void str_printf(struct gstr *gs, const char *fmt, ...) in str_printf() argument
102 str_append(gs, s); in str_printf()
107 const char *str_get(struct gstr *gs) in str_get() argument
109 return gs->s; in str_get()