X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/a69061fdb7380d73715aeb3a0da6e91a24df90e4..ae4c1ee11379e353f2a94201181a3a9dab75b646:/parsing.c diff --git a/parsing.c b/parsing.c index 8aad1dd..332d61c 100644 --- a/parsing.c +++ b/parsing.c @@ -201,13 +201,13 @@ struct commitinfo *cgit_parse_commit(struct commit *commit) struct taginfo *cgit_parse_tag(struct tag *tag) { void *data; - char type[20]; + enum object_type type; unsigned long size; char *p, *t; struct taginfo *ret; - data = read_sha1_file(tag->object.sha1, type, &size); - if (!data || strcmp(type, tag_type)) { + data = read_sha1_file(tag->object.sha1, &type, &size); + if (!data || type != OBJ_TAG) { free(data); return 0; } @@ -220,7 +220,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag) p = data; - while (p) { + while (p && *p) { if (*p == '\n') break; @@ -238,7 +238,7 @@ struct taginfo *cgit_parse_tag(struct tag *tag) while (p && (*p == '\n')) p = strchr(p, '\n') + 1; - if (p) + if (p && *p) ret->msg = xstrdup(p); free(data); return ret;