git @ Cat's Eye Technologies stringie / cf864b0
As elsewhere, I'm a bit sick of the strdup() nonsense, so, this. Chris Pressey 4 years ago
1 changed file(s) with 9 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1515 } *root;
1616
1717 void run(char *);
18
19 char *strdupe(const char *s)
20 {
21 char *t = malloc(strlen(s) + 1);
22 strcpy(t, s);
23 return t;
24 }
1825
1926 char *pop(void)
2027 {
4047 {
4148 char *e, *f;
4249 e = pop();
43 f = strdup(e);
50 f = strdupe(e);
4451 push(e);
4552 push(f);
4653 }
166173
167174 int main(int argc, char **argv)
168175 {
169 char *program = strdup(argv[1]);
176 char *program = strdupe(argv[1]);
170177 root = NULL;
171178 run(program);
172179 exit(0);