]> granicus.if.org Git - yasm/commitdiff
Don't block global src variable. While I'm here, change to use SLIST_FOREACH.
authorPeter Johnson <peter@tortall.net>
Sun, 17 Mar 2002 06:03:36 +0000 (06:03 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 17 Mar 2002 06:03:36 +0000 (06:03 -0000)
svn path=/trunk/yasm/; revision=515

modules/preprocs/yapp/yapp-preproc.c
src/preprocs/yapp/yapp-preproc.c

index f38ca02226640a510243c7035ca81f50b29af7ff..955eb5118ee53b47513609932238d5ccee1e128a 100644 (file)
@@ -408,23 +408,21 @@ expand_macro(YAPP_Macro *ym)
 
     if (ym->type == YAPP_DEFINE) {
        if (ym->args == -1) {
-           source *src;
+           source *mac;
            /* no parens to deal with */
-           src = SLIST_FIRST(&ym->macro_head);
-           while (src != NULL) {
-               if (src->token.type == IDENT) {
-                   YAPP_Macro *imacro = yapp_macro_get(src->token.str);
+           SLIST_FOREACH (mac, &ym->macro_head, next) {
+               if (mac->token.type == IDENT) {
+                   YAPP_Macro *imacro = yapp_macro_get(mac->token.str);
                    if (imacro != NULL && !imacro->expanding) {
                        expand_macro(imacro);
                    }
                    else {
-                       copy_token(&src->token);
+                       copy_token(&mac->token);
                    }
                }
                else {
-                   copy_token(&src->token);
+                   copy_token(&mac->token);
                }
-               src = SLIST_NEXT(src, next);
            }
        }
        else
index f38ca02226640a510243c7035ca81f50b29af7ff..955eb5118ee53b47513609932238d5ccee1e128a 100644 (file)
@@ -408,23 +408,21 @@ expand_macro(YAPP_Macro *ym)
 
     if (ym->type == YAPP_DEFINE) {
        if (ym->args == -1) {
-           source *src;
+           source *mac;
            /* no parens to deal with */
-           src = SLIST_FIRST(&ym->macro_head);
-           while (src != NULL) {
-               if (src->token.type == IDENT) {
-                   YAPP_Macro *imacro = yapp_macro_get(src->token.str);
+           SLIST_FOREACH (mac, &ym->macro_head, next) {
+               if (mac->token.type == IDENT) {
+                   YAPP_Macro *imacro = yapp_macro_get(mac->token.str);
                    if (imacro != NULL && !imacro->expanding) {
                        expand_macro(imacro);
                    }
                    else {
-                       copy_token(&src->token);
+                       copy_token(&mac->token);
                    }
                }
                else {
-                   copy_token(&src->token);
+                   copy_token(&mac->token);
                }
-               src = SLIST_NEXT(src, next);
            }
        }
        else