t: wrap complicated expect_code users in a block
[gitweb.git] / pathspec.c
index 80430999553d8fda8d095b007bb08c1999bf6993..9304ee33d75ab9de14e4a7b6dc96f5dd8028c464 100644 (file)
@@ -338,7 +338,7 @@ static void NORETURN unsupported_magic(const char *pattern,
                if (!(magic & m->bit))
                        continue;
                if (sb.len)
-                       strbuf_addstr(&sb, " ");
+                       strbuf_addch(&sb, ' ');
                if (short_magic & m->bit)
                        strbuf_addf(&sb, "'%c'", m->mnemonic);
                else
@@ -389,8 +389,7 @@ void parse_pathspec(struct pathspec *pathspec,
                if (!(flags & PATHSPEC_PREFER_CWD))
                        die("BUG: PATHSPEC_PREFER_CWD requires arguments");
 
-               pathspec->items = item = xmalloc(sizeof(*item));
-               memset(item, 0, sizeof(*item));
+               pathspec->items = item = xcalloc(1, sizeof(*item));
                item->match = prefix;
                item->original = prefix;
                item->nowildcard_len = item->len = strlen(prefix);