]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Sync with maint-2.37
authorJunio C Hamano <gitster@pobox.com>
Thu, 19 Jan 2023 21:48:26 +0000 (13:48 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Jan 2023 21:48:26 +0000 (13:48 -0800)
* maint-2.37:
  attr: adjust a mismatched data type

1  2 
attr.c

diff --combined attr.c
index b43e93ee96573780737bb55a4da23c2e8d0582c7,c010bd9fa3ed3fe3ff0998d34ed0d2acfddc2eef..9922529b58c381dbc2cdf778f7e59b17fdf64657
--- 1/attr.c
--- 2/attr.c
+++ b/attr.c
@@@ -23,6 -23,10 +23,6 @@@ static const char git_attr__unknown[] 
  #define ATTR__UNSET NULL
  #define ATTR__UNKNOWN git_attr__unknown
  
 -#ifndef DEBUG_ATTR
 -#define DEBUG_ATTR 0
 -#endif
 -
  struct git_attr {
        unsigned int attr_nr; /* unique attribute number */
        char name[FLEX_ARRAY]; /* attribute name */
@@@ -57,10 -61,10 +57,10 @@@ struct attr_hash_entry 
  };
  
  /* attr_hashmap comparison function */
 -static int attr_hash_entry_cmp(const void *unused_cmp_data,
 +static int attr_hash_entry_cmp(const void *cmp_data UNUSED,
                               const struct hashmap_entry *eptr,
                               const struct hashmap_entry *entry_or_key,
 -                             const void *unused_keydata)
 +                             const void *keydata UNUSED)
  {
        const struct attr_hash_entry *a, *b;
  
@@@ -752,7 -756,7 +752,7 @@@ static struct attr_stack *read_attr_fro
        struct attr_stack *res;
        char *buf, *sp;
        int lineno = 0;
-       size_t size;
+       unsigned long size;
  
        if (!istate)
                return NULL;
@@@ -824,6 -828,33 +824,6 @@@ static struct attr_stack *read_attr(str
        return res;
  }
  
 -#if DEBUG_ATTR
 -static void debug_info(const char *what, struct attr_stack *elem)
 -{
 -      fprintf(stderr, "%s: %s\n", what, elem->origin ? elem->origin : "()");
 -}
 -static void debug_set(const char *what, const char *match, struct git_attr *attr, const void *v)
 -{
 -      const char *value = v;
 -
 -      if (ATTR_TRUE(value))
 -              value = "set";
 -      else if (ATTR_FALSE(value))
 -              value = "unset";
 -      else if (ATTR_UNSET(value))
 -              value = "unspecified";
 -
 -      fprintf(stderr, "%s: %s => %s (%s)\n",
 -              what, attr->name, (char *) value, match);
 -}
 -#define debug_push(a) debug_info("push", (a))
 -#define debug_pop(a) debug_info("pop", (a))
 -#else
 -#define debug_push(a) do { ; } while (0)
 -#define debug_pop(a) do { ; } while (0)
 -#define debug_set(a,b,c,d) do { ; } while (0)
 -#endif /* DEBUG_ATTR */
 -
  static const char *git_etc_gitattributes(void)
  {
        static const char *system_wide;
@@@ -944,6 -975,7 +944,6 @@@ static void prepare_attr_stack(struct i
                    (!namelen || path[namelen] == '/'))
                        break;
  
 -              debug_pop(elem);
                *stack = elem->prev;
                attr_stack_free(elem);
        }
@@@ -1012,12 -1044,12 +1012,12 @@@ static int path_matches(const char *pat
        }
        return match_pathname(pathname, pathlen - isdir,
                              base, baselen,
 -                            pattern, prefix, pat->patternlen, pat->flags);
 +                            pattern, prefix, pat->patternlen);
  }
  
  static int macroexpand_one(struct all_attrs_item *all_attrs, int nr, int rem);
  
 -static int fill_one(const char *what, struct all_attrs_item *all_attrs,
 +static int fill_one(struct all_attrs_item *all_attrs,
                    const struct match_attr *a, int rem)
  {
        size_t i;
                const char *v = a->state[i - 1].setto;
  
                if (*n == ATTR__UNKNOWN) {
 -                      debug_set(what,
 -                                a->is_macro ? a->u.attr->name : a->u.pat.pattern,
 -                                attr, v);
                        *n = v;
                        rem--;
                        rem = macroexpand_one(all_attrs, attr->attr_nr, rem);
@@@ -1050,7 -1085,7 +1050,7 @@@ static int fill(const char *path, int p
                                continue;
                        if (path_matches(path, pathlen, basename_offset,
                                         &a->u.pat, base, stack->originlen))
 -                              rem = fill_one("fill", all_attrs, a, rem);
 +                              rem = fill_one(all_attrs, a, rem);
                }
        }
  
@@@ -1062,7 -1097,7 +1062,7 @@@ static int macroexpand_one(struct all_a
        const struct all_attrs_item *item = &all_attrs[nr];
  
        if (item->macro && item->value == ATTR__TRUE)
 -              return fill_one("expand", all_attrs, item->macro, rem);
 +              return fill_one(all_attrs, item->macro, rem);
        else
                return rem;
  }