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