From: Junio C Hamano Date: Mon, 6 Sep 2010 07:11:59 +0000 (-0700) Subject: Merge branch 'xx/trivial' into maint X-Git-Tag: v1.7.3-rc0^2 X-Git-Url: http://git.tremily.us/?p=git.git;a=commitdiff_plain;h=af24059fa299f1656692f5807eddd3b30b5f3cfb Merge branch 'xx/trivial' into maint * xx/trivial: tag.c: whitespace breakages fix Fix whitespace issue in object.c t5505: add missing && --- af24059fa299f1656692f5807eddd3b30b5f3cfb diff --cc object.c index 277b3ddba,a23fbeaeb..2eda53cc6 --- a/object.c +++ b/object.c @@@ -211,12 -211,33 +211,12 @@@ struct object_list *object_list_insert( struct object_list **list_p) { struct object_list *new_list = xmalloc(sizeof(struct object_list)); - new_list->item = item; - new_list->next = *list_p; - *list_p = new_list; - return new_list; + new_list->item = item; + new_list->next = *list_p; + *list_p = new_list; + return new_list; } -void object_list_append(struct object *item, - struct object_list **list_p) -{ - while (*list_p) { - list_p = &((*list_p)->next); - } - *list_p = xmalloc(sizeof(struct object_list)); - (*list_p)->next = NULL; - (*list_p)->item = item; -} - -unsigned object_list_length(struct object_list *list) -{ - unsigned ret = 0; - while (list) { - list = list->next; - ret++; - } - return ret; -} - int object_list_contains(struct object_list *list, struct object *obj) { while (list) { diff --cc tag.c index 85607c219,f2dd1d0e0..28641cf85 --- a/tag.c +++ b/tag.c @@@ -28,38 -28,21 +28,38 @@@ struct tag *lookup_tag(const unsigned c return create_object(sha1, OBJ_TAG, alloc_tag_node()); if (!obj->type) obj->type = OBJ_TAG; - if (obj->type != OBJ_TAG) { - error("Object %s is a %s, not a tag", - sha1_to_hex(sha1), typename(obj->type)); - return NULL; - } - return (struct tag *) obj; + if (obj->type != OBJ_TAG) { + error("Object %s is a %s, not a tag", + sha1_to_hex(sha1), typename(obj->type)); + return NULL; + } + return (struct tag *) obj; } +static unsigned long parse_tag_date(const char *buf, const char *tail) +{ + const char *dateptr; + + while (buf < tail && *buf++ != '>') + /* nada */; + if (buf >= tail) + return 0; + dateptr = buf; + while (buf < tail && *buf++ != '\n') + /* nada */; + if (buf >= tail) + return 0; + /* dateptr < buf && buf[-1] == '\n', so strtoul will stop at buf-1 */ + return strtoul(dateptr, NULL, 10); +} + int parse_tag_buffer(struct tag *item, void *data, unsigned long size) { - int typelen, taglen; unsigned char sha1[20]; - const char *type_line, *tag_line, *sig_line; char type[20]; - const char *start = data; + const char *bufptr = data; + const char *tail = bufptr + size; + const char *nl; if (item->object.parsed) return 0;