isl_arg.c: extract out free_user
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 20 Feb 2013 11:42:35 +0000 (20 12:42 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 20 Feb 2013 15:51:53 +0000 (20 16:51 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_arg.c

index 873ab02..7811b6b 100644 (file)
--- a/isl_arg.c
+++ b/isl_arg.c
@@ -141,6 +141,12 @@ static void free_str_list(struct isl_arg *arg, void *opt)
        free(list);
 }
 
+static void free_user(struct isl_arg *arg, void *opt)
+{
+       if (arg->u.user.clear)
+               arg->u.user.clear(((char *)opt) + arg->offset);
+}
+
 static void free_args(struct isl_arg *arg, void *opt)
 {
        int i;
@@ -162,8 +168,7 @@ static void free_args(struct isl_arg *arg, void *opt)
                        free_str_list(&arg[i], opt);
                        break;
                case isl_arg_user:
-                       if (arg[i].u.user.clear)
-                               arg[i].u.user.clear(((char *)opt) + arg[i].offset);
+                       free_user(&arg[i], opt);
                        break;
                case isl_arg_alias:
                case isl_arg_bool: