format-patch: introduce --base=auto option
[gitweb.git] / diffcore-order.c
index 1bfcc39f904898b488b5ea0dad1ef3bcb81466ce..69d41f7a5781a10e43cf0e74f20be85a0d1fc5be 100644 (file)
@@ -52,7 +52,7 @@ static void prepare_order(const char *orderfile)
                }
                if (pass == 0) {
                        order_cnt = cnt;
-                       order = xmalloc(sizeof(*order) * cnt);
+                       ALLOC_ARRAY(order, cnt);
                }
        }
 }
@@ -67,7 +67,7 @@ static int match_order(const char *path)
                strbuf_addstr(&p, path);
                while (p.buf[0]) {
                        char *cp;
-                       if (!fnmatch(order[i], p.buf, 0))
+                       if (!wildmatch(order[i], p.buf, 0, NULL))
                                return i;
                        cp = strrchr(p.buf, '/');
                        if (!cp)
@@ -120,7 +120,7 @@ void diffcore_order(const char *orderfile)
        if (!q->nr)
                return;
 
-       o = xmalloc(sizeof(*o) * q->nr);
+       ALLOC_ARRAY(o, q->nr);
        for (i = 0; i < q->nr; i++)
                o[i].obj = q->queue[i];
        order_objects(orderfile, pair_pathtwo, o, q->nr);