]> wimlib.net Git - wimlib/blobdiff - programs/imagex.c
imagex.c: Remove unused swap() macro
[wimlib] / programs / imagex.c
index 688b1e172dbdef2266f66d68dfe68bed785d1d03..8e9e95218794e2481827406bcbf15781e6e30957 100644 (file)
@@ -35,9 +35,6 @@
 
 #define ARRAY_LEN(array) (sizeof(array) / sizeof(array[0]))
 
-#define swap(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); \
-                               a = __b; b = __a; })
-
 #define for_opt(c, opts) while ((c = getopt_long_only(argc, (char**)argv, "", \
                                opts, NULL)) != -1)
 
@@ -199,24 +196,6 @@ static void imagex_error_with_errno(const char *format, ...)
        va_end(va);
 }
 
-static const char *path_basename(const char *path)
-{
-       const char *p = path;
-       while (*p)
-               p++;
-       p--;
-
-       /* Trailing slashes. */
-       while ((p != path - 1) && *p == '/')
-               p--;
-
-       while ((p != path - 1) && *p != '/')
-               p--;
-
-       return p + 1;
-}
-
-
 static int verify_image_exists(int image)
 {
        if (image == WIM_NO_IMAGE) {
@@ -467,9 +446,11 @@ static int imagex_apply(int argc, const char **argv)
                                   additional_swms, num_additional_swms);
 out:
        wimlib_free(w);
-       if (additional_swms)
+       if (additional_swms) {
                for (unsigned i = 0; i < num_additional_swms; i++)
                        wimlib_free(additional_swms[i]);
+               free(additional_swms);
+       }
        return ret;
 }
 
@@ -859,9 +840,11 @@ static int imagex_export(int argc, const char **argv)
 out:
        wimlib_free(src_w);
        wimlib_free(dest_w);
-       if (additional_swms)
+       if (additional_swms) {
                for (unsigned i = 0; i < num_additional_swms; i++)
                        wimlib_free(additional_swms[i]);
+               free(additional_swms);
+       }
        return ret;
 }
 
@@ -1116,7 +1099,7 @@ static int imagex_info(int argc, const char **argv)
                }
        }
 out:
-       wimlib_free(w);
+       /*wimlib_free(w);*/
        return ret;
 }