# HG changeset patch # User David A. Holland # Date 1434090088 14400 # Node ID 09cfad6772de0c334a6fc955e2fa2e7ceb970d5f # Parent 6ff17ab68b163ec4cfd29a3ad5188555fd5347aa Some minor cosmetic changes relating to ei->itemtype. diff -r 6ff17ab68b16 -r 09cfad6772de macro.c --- a/macro.c Fri Jun 12 02:15:43 2015 -0400 +++ b/macro.c Fri Jun 12 02:21:28 2015 -0400 @@ -39,10 +39,10 @@ #include "output.h" struct expansionitem { - enum { EI_PARAM, EI_STRING, EI_FILE, EI_LINE } itemtype; + enum { EI_STRING, EI_PARAM, EI_FILE, EI_LINE } itemtype; union { - char *string; - unsigned param; + char *string; /* EI_STRING */ + unsigned param; /* EI_PARAM */ }; }; DECLARRAY(expansionitem, static UNUSED); @@ -132,8 +132,14 @@ void expansionitem_destroy(struct expansionitem *ei) { - if (ei->itemtype == EI_STRING) { + switch (ei->itemtype) { + case EI_STRING: dostrfree(ei->string); + break; + case EI_PARAM: + case EI_FILE: + case EI_LINE: + break; } dofree(ei, sizeof(*ei)); } @@ -815,17 +821,17 @@ for (i=0; icurmacro->expansion, i); switch (ei->itemtype) { - case EI_STRING: + case EI_STRING: len += strlen(ei->string); break; - case EI_PARAM: + case EI_PARAM: arg = stringarray_get(&es->args, ei->param); len += strlen(arg); break; - case EI_FILE: + case EI_FILE: len += strlen(place_getname(p)) + 2; break; - case EI_LINE: + case EI_LINE: len += snprintf(numbuf, sizeof(numbuf), "%u", p->line); break; } @@ -836,19 +842,19 @@ for (i=0; icurmacro->expansion, i); switch (ei->itemtype) { - case EI_STRING: + case EI_STRING: strcat(ret, ei->string); break; - case EI_PARAM: + case EI_PARAM: arg = stringarray_get(&es->args, ei->param); strcat(ret, arg); break; - case EI_FILE: + case EI_FILE: strcat(ret, "\""); strcat(ret, place_getname(p)); strcat(ret, "\""); break; - case EI_LINE: + case EI_LINE: snprintf(numbuf, sizeof(numbuf), "%u", p->line); strcat(ret, numbuf); break;