Merge branch 'hv/config-from-blob' into maint
authorJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2013 21:40:18 +0000 (14:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2013 21:40:18 +0000 (14:40 -0700)
Compilation fix on platforms with fgetc() and friends defined as
macros.

* hv/config-from-blob:
config: do not use C function names as struct members

1  2 
config.c
diff --combined config.c
index e13a7b65e7615da7d788fddd001716a17baef5db,95f9a449d73fb8732b6d9260cf027b0aaf0419c5..9f9bf0cc9a1405e938fddbedc44468782ad61021
+++ b/config.c
@@@ -27,9 -27,9 +27,9 @@@ struct config_source 
        struct strbuf value;
        struct strbuf var;
  
-       int (*fgetc)(struct config_source *c);
-       int (*ungetc)(int c, struct config_source *conf);
-       long (*ftell)(struct config_source *c);
+       int (*do_fgetc)(struct config_source *c);
+       int (*do_ungetc)(int c, struct config_source *conf);
+       long (*do_ftell)(struct config_source *c);
  };
  
  static struct config_source *cf;
@@@ -107,7 -107,7 +107,7 @@@ static int handle_path_include(const ch
                path = buf.buf;
        }
  
 -      if (!access_or_die(path, R_OK)) {
 +      if (!access_or_die(path, R_OK, 0)) {
                if (++inc->depth > MAX_INCLUDE_DEPTH)
                        die(include_depth_advice, MAX_INCLUDE_DEPTH, path,
                            cf && cf->name ? cf->name : "the command line");
@@@ -217,13 -217,13 +217,13 @@@ int git_config_from_parameters(config_f
  
  static int get_next_char(void)
  {
-       int c = cf->fgetc(cf);
+       int c = cf->do_fgetc(cf);
  
        if (c == '\r') {
                /* DOS like systems */
-               c = cf->fgetc(cf);
+               c = cf->do_fgetc(cf);
                if (c != '\n') {
-                       cf->ungetc(c, cf);
+                       cf->do_ungetc(c, cf);
                        c = '\r';
                }
        }
@@@ -613,20 -613,7 +613,20 @@@ static int git_default_core_config(cons
                trust_ctime = git_config_bool(var, value);
                return 0;
        }
 -      if (!strcmp(var, "core.statinfo")) {
 +      if (!strcmp(var, "core.statinfo") ||
 +          !strcmp(var, "core.checkstat")) {
 +              /*
 +               * NEEDSWORK: statinfo was a typo in v1.8.2 that has
 +               * never been advertised.  we will remove it at Git
 +               * 2.0 boundary.
 +               */
 +              if (!strcmp(var, "core.statinfo")) {
 +                      static int warned;
 +                      if (!warned++) {
 +                              warning("'core.statinfo' will be removed in Git 2.0; "
 +                                      "use 'core.checkstat' instead.");
 +                      }
 +              }
                if (!strcasecmp(value, "default"))
                        check_stat = 1;
                else if (!strcasecmp(value, "minimal"))
                return 0;
        }
  
 -      if (!strcmp(var, "core.logpackaccess"))
 -              return git_config_string(&log_pack_access, var, value);
 -
        if (!strcmp(var, "core.autocrlf")) {
                if (value && !strcasecmp(value, "input")) {
                        if (core_eol == EOL_CRLF)
@@@ -992,9 -982,9 +992,9 @@@ int git_config_from_file(config_fn_t fn
                top.u.file = f;
                top.name = filename;
                top.die_on_error = 1;
-               top.fgetc = config_file_fgetc;
-               top.ungetc = config_file_ungetc;
-               top.ftell = config_file_ftell;
+               top.do_fgetc = config_file_fgetc;
+               top.do_ungetc = config_file_ungetc;
+               top.do_ftell = config_file_ftell;
  
                ret = do_config_from(&top, fn, data);
  
@@@ -1013,9 -1003,9 +1013,9 @@@ int git_config_from_buf(config_fn_t fn
        top.u.buf.pos = 0;
        top.name = name;
        top.die_on_error = 0;
-       top.fgetc = config_buf_fgetc;
-       top.ungetc = config_buf_ungetc;
-       top.ftell = config_buf_ftell;
+       top.do_fgetc = config_buf_fgetc;
+       top.do_ungetc = config_buf_ungetc;
+       top.do_ftell = config_buf_ftell;
  
        return do_config_from(&top, fn, data);
  }
@@@ -1082,23 -1072,23 +1082,23 @@@ int git_config_early(config_fn_t fn, vo
  
        home_config_paths(&user_config, &xdg_config, "config");
  
 -      if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK)) {
 +      if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
                ret += git_config_from_file(fn, git_etc_gitconfig(),
                                            data);
                found += 1;
        }
  
 -      if (xdg_config && !access_or_die(xdg_config, R_OK)) {
 +      if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK)) {
                ret += git_config_from_file(fn, xdg_config, data);
                found += 1;
        }
  
 -      if (user_config && !access_or_die(user_config, R_OK)) {
 +      if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK)) {
                ret += git_config_from_file(fn, user_config, data);
                found += 1;
        }
  
 -      if (repo_config && !access_or_die(repo_config, R_OK)) {
 +      if (repo_config && !access_or_die(repo_config, R_OK, 0)) {
                ret += git_config_from_file(fn, repo_config, data);
                found += 1;
        }
@@@ -1196,7 -1186,7 +1196,7 @@@ static int store_aux(const char *key, c
                                return 1;
                        }
  
-                       store.offset[store.seen] = cf->ftell(cf);
+                       store.offset[store.seen] = cf->do_ftell(cf);
                        store.seen++;
                }
                break;
                 * Do not increment matches: this is no match, but we
                 * just made sure we are in the desired section.
                 */
-               store.offset[store.seen] = cf->ftell(cf);
+               store.offset[store.seen] = cf->do_ftell(cf);
                /* fallthru */
        case SECTION_END_SEEN:
        case START:
                if (matches(key, value)) {
-                       store.offset[store.seen] = cf->ftell(cf);
+                       store.offset[store.seen] = cf->do_ftell(cf);
                        store.state = KEY_SEEN;
                        store.seen++;
                } else {
                        if (strrchr(key, '.') - key == store.baselen &&
                              !strncmp(key, store.key, store.baselen)) {
                                        store.state = SECTION_SEEN;
-                                       store.offset[store.seen] = cf->ftell(cf);
+                                       store.offset[store.seen] = cf->do_ftell(cf);
                        }
                }
        }