Correct typo. We should use foreach_depth as the request data index not stack depth.
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 27 Aug 2013 16:43:19 +0000 (17:43 +0100)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Tue, 27 Aug 2013 16:43:30 +0000 (17:43 +0100)
Various whitespace fixes

src/main/modcall.c
src/main/xlat.c

index e12da5b..52e4c26 100644 (file)
@@ -606,6 +606,10 @@ redo:
                        exit(1);
                }
 
+               /*
+                *      Figure out how deep we are in nesting by looking at request_data
+                *      stored previously.
+                */
                for (i = 0; i < 8; i++) {
                        if (!request_data_reference(request,
                                                    radius_get_vp, i)) {
@@ -661,8 +665,7 @@ redo:
                         *      a huge priority as any leaked memory
                         *      will be freed on request free.
                         */
-                       request_data_add(request, radius_get_vp,
-                                        depth, copy_p, false);
+                       request_data_add(request, radius_get_vp, foreach_depth, copy_p, false);
 
                        /*
                         *      Initialize the childs stack frame.
@@ -672,26 +675,20 @@ redo:
                        next->result = entry->result;
                        next->priority = 0;
 
-                       if (!modcall_recurse(request, component,
-                                            depth + 1,
-                                            next)) {
-                               request_data_get(request,
-                                                radius_get_vp,
-                                                depth);
+                       if (!modcall_recurse(request, component, depth + 1, next)) {
+                               request_data_get(request, radius_get_vp, foreach_depth);
                                pairfree(&copy);
+
                                break;
                        }
 
                        vp = pairfindnext(&cursor, vp->da->attr, vp->da->vendor, TAG_ANY);
 
                        /*
-                        *      Delete the cached attribute,
-                        *      if it exists.
+                        *      Delete the cached attribute, if it exists.
                         */
                        if (copy) {
-                               request_data_get(request,
-                                                radius_get_vp,
-                                                depth);
+                               request_data_get(request, radius_get_vp, foreach_depth);
                                pairfree(&copy);
                        } else {
                                break;
index 0d5745d..ec797c4 100644 (file)
@@ -279,8 +279,7 @@ static ssize_t xlat_foreach(void *instance, REQUEST *request,
        /*
         *      See modcall, "FOREACH" for how this works.
         */
-       pvp = (VALUE_PAIR **) request_data_reference(request, radius_get_vp,
-                                                    *(int*) instance);
+       pvp = (VALUE_PAIR **) request_data_reference(request, radius_get_vp, *(int*) instance);
        if (!pvp || !*pvp) {
                *out = '\0';
                return 0;