]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'bw/c-plus-plus'
authorJunio C Hamano <gitster@pobox.com>
Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)
Avoid using identifiers that clash with C++ keywords.  Even though
it is not a goal to compile Git with C++ compilers, changes like
this help use of code analysis tools that targets C++ on our
codebase.

* bw/c-plus-plus: (37 commits)
  replace: rename 'new' variables
  trailer: rename 'template' variables
  tempfile: rename 'template' variables
  wrapper: rename 'template' variables
  environment: rename 'namespace' variables
  diff: rename 'template' variables
  environment: rename 'template' variables
  init-db: rename 'template' variables
  unpack-trees: rename 'new' variables
  trailer: rename 'new' variables
  submodule: rename 'new' variables
  split-index: rename 'new' variables
  remote: rename 'new' variables
  ref-filter: rename 'new' variables
  read-cache: rename 'new' variables
  line-log: rename 'new' variables
  imap-send: rename 'new' variables
  http: rename 'new' variables
  entry: rename 'new' variables
  diffcore-delta: rename 'new' variables
  ...

34 files changed:
1  2 
apply.c
blame.c
builtin/cat-file.c
builtin/checkout.c
builtin/fsck.c
builtin/index-pack.c
builtin/merge.c
builtin/mktree.c
builtin/pack-objects.c
builtin/prune.c
builtin/replace.c
builtin/rev-parse.c
builtin/tag.c
builtin/unpack-objects.c
bulk-checkin.c
cache.h
combine-diff.c
commit.c
diff-lib.c
diff.c
environment.c
fast-import.c
http-push.c
http.c
log-tree.c
object.c
pack-check.c
packfile.c
read-cache.c
remote.c
sequencer.c
sha1_file.c
split-index.c
unpack-trees.c

diff --cc apply.c
Simple merge
diff --cc blame.c
Simple merge
Simple merge
Simple merge
diff --cc builtin/fsck.c
Simple merge
index 7e3e1a461c4469ea0272d9545d7173e984b1ebf4,8b87090e2342510905db7429d1b9e49b45ffe520..59878e70b8017e1a531f2976230419a57c210038
@@@ -448,11 -448,11 +448,11 @@@ static void *unpack_entry_data(off_t of
        int hdrlen;
  
        if (!is_delta_type(type)) {
-               hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
+               hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), size) + 1;
 -              git_SHA1_Init(&c);
 -              git_SHA1_Update(&c, hdr, hdrlen);
 +              the_hash_algo->init_fn(&c);
 +              the_hash_algo->update_fn(&c, hdr, hdrlen);
        } else
 -              sha1 = NULL;
 +              oid = NULL;
        if (type == OBJ_BLOB && size > big_file_threshold)
                buf = fixed_buf;
        else
@@@ -958,8 -958,9 +958,8 @@@ static void resolve_delta(struct object
        free(delta_data);
        if (!result->data)
                bad_object(delta_obj->idx.offset, _("failed to apply delta"));
 -      hash_sha1_file(result->data, result->size,
 -                     type_name(delta_obj->real_type),
 -                     delta_obj->idx.oid.hash);
 +      hash_object_file(result->data, result->size,
-                        typename(delta_obj->real_type), &delta_obj->idx.oid);
++                       type_name(delta_obj->real_type), &delta_obj->idx.oid);
        sha1_object(result->data, NULL, result->size, delta_obj->real_type,
                    &delta_obj->idx.oid);
        counter_lock();
diff --cc builtin/merge.c
Simple merge
Simple merge
Simple merge
diff --cc builtin/prune.c
Simple merge
index 83d3235721470167d362f64763745d8fb9852d7b,303ca134dcc00131986a79c31f68dc6dcd70be0d..9f01f3fc7f86ef6e13933524441f330d3dae1573
@@@ -355,7 -355,7 +355,7 @@@ static void check_one_mergetag(struct c
        struct tag *tag;
        int i;
  
-       hash_object_file(extra->value, extra->len, typename(OBJ_TAG), &tag_oid);
 -      hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), tag_oid.hash);
++      hash_object_file(extra->value, extra->len, type_name(OBJ_TAG), &tag_oid);
        tag = lookup_tag(&tag_oid);
        if (!tag)
                die(_("bad mergetag in commit '%s'"), ref);
@@@ -410,7 -410,7 +410,7 @@@ static int create_graft(int argc, cons
  
        check_mergetags(commit, argc, argv);
  
-       if (write_object_file(buf.buf, buf.len, commit_type, &new))
 -      if (write_sha1_file(buf.buf, buf.len, commit_type, new_oid.hash))
++      if (write_object_file(buf.buf, buf.len, commit_type, &new_oid))
                die(_("could not write replacement commit for: '%s'"), old_ref);
  
        strbuf_release(&buf);
Simple merge
diff --cc builtin/tag.c
Simple merge
index 7235d2ffbff78400384f92ea53233ec4dfbf0687,e9307907018a028e526ff39a0432e840a8e7be6b..9f96949bc02be374382283cf1f35ac9ec946da2f
@@@ -172,8 -172,7 +172,8 @@@ static void write_cached_object(struct 
  {
        struct object_id oid;
  
 -      if (write_sha1_file(obj_buf->buffer, obj_buf->size, type_name(obj->type), oid.hash) < 0)
 +      if (write_object_file(obj_buf->buffer, obj_buf->size,
-                             typename(obj->type), &oid) < 0)
++                            type_name(obj->type), &oid) < 0)
                die("failed to write object %s", oid_to_hex(&obj->oid));
        obj->flags |= FLAG_WRITTEN;
  }
@@@ -238,16 -237,14 +238,16 @@@ static void write_object(unsigned nr, e
                         void *buf, unsigned long size)
  {
        if (!strict) {
-               if (write_object_file(buf, size, typename(type),
 -              if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
++              if (write_object_file(buf, size, type_name(type),
 +                                    &obj_list[nr].oid) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
                free(buf);
                obj_list[nr].obj = NULL;
        } else if (type == OBJ_BLOB) {
                struct blob *blob;
-               if (write_object_file(buf, size, typename(type),
 -              if (write_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash) < 0)
++              if (write_object_file(buf, size, type_name(type),
 +                                    &obj_list[nr].oid) < 0)
                        die("failed to write object");
                added_object(nr, type, buf, size);
                free(buf);
        } else {
                struct object *obj;
                int eaten;
-               hash_object_file(buf, size, typename(type), &obj_list[nr].oid);
 -              hash_sha1_file(buf, size, type_name(type), obj_list[nr].oid.hash);
++              hash_object_file(buf, size, type_name(type), &obj_list[nr].oid);
                added_object(nr, type, buf, size);
                obj = parse_object_buffer(&obj_list[nr].oid, type, size, buf,
                                          &eaten);
diff --cc bulk-checkin.c
index 8bcd1c8665d02840d7d77bc677b293595f9e0a31,bb788494fdab32cbbfb0f022c8826cc5c24a459f..9d87eac07ba1d9bf01bfe4a24c8ba784e71dbac4
@@@ -203,9 -203,9 +203,9 @@@ static int deflate_to_pack(struct bulk_
                return error("cannot find the current offset");
  
        header_len = xsnprintf((char *)obuf, sizeof(obuf), "%s %" PRIuMAX,
-                              typename(type), (uintmax_t)size) + 1;
+                              type_name(type), (uintmax_t)size) + 1;
 -      git_SHA1_Init(&ctx);
 -      git_SHA1_Update(&ctx, obuf, header_len);
 +      the_hash_algo->init_fn(&ctx);
 +      the_hash_algo->update_fn(&ctx, obuf, header_len);
  
        /* Note: idx is non-NULL when we are writing */
        if ((flags & HASH_WRITE_OBJECT) != 0)
diff --cc cache.h
Simple merge
diff --cc combine-diff.c
Simple merge
diff --cc commit.c
Simple merge
diff --cc diff-lib.c
Simple merge
diff --cc diff.c
Simple merge
diff --cc environment.c
Simple merge
diff --cc fast-import.c
index 0f818cd9328d182b44649a130645a871eb63cfb5,92b89d191a1b91036e1a6e3dea316bc07cf0abcb..58ef360da43d3d7d55733cb8ee66014351814921
@@@ -1096,11 -1096,11 +1096,11 @@@ static int store_object
        git_zstream s;
  
        hdrlen = xsnprintf((char *)hdr, sizeof(hdr), "%s %lu",
-                          typename(type), (unsigned long)dat->len) + 1;
+                          type_name(type), (unsigned long)dat->len) + 1;
 -      git_SHA1_Init(&c);
 -      git_SHA1_Update(&c, hdr, hdrlen);
 -      git_SHA1_Update(&c, dat->buf, dat->len);
 -      git_SHA1_Final(oid.hash, &c);
 +      the_hash_algo->init_fn(&c);
 +      the_hash_algo->update_fn(&c, hdr, hdrlen);
 +      the_hash_algo->update_fn(&c, dat->buf, dat->len);
 +      the_hash_algo->final_fn(oid.hash, &c);
        if (oidout)
                oidcpy(oidout, &oid);
  
diff --cc http-push.c
Simple merge
diff --cc http.c
Simple merge
diff --cc log-tree.c
index 22b2fb6c581743392d9315b7a5d5ca4d2259aea9,2eeddbeb351a31015e72980867a2de46c63bfcbd..bdf23c5f7b89eda2997057285d1fff64acb0d30c
@@@ -499,7 -499,7 +499,7 @@@ static void show_one_mergetag(struct co
        int status, nth;
        size_t payload_size, gpg_message_offset;
  
-       hash_object_file(extra->value, extra->len, typename(OBJ_TAG), &oid);
 -      hash_sha1_file(extra->value, extra->len, type_name(OBJ_TAG), oid.hash);
++      hash_object_file(extra->value, extra->len, type_name(OBJ_TAG), &oid);
        tag = lookup_tag(&oid);
        if (!tag)
                return; /* error message already given */
diff --cc object.c
Simple merge
diff --cc pack-check.c
Simple merge
diff --cc packfile.c
Simple merge
diff --cc read-cache.c
index 28bf0db9d95777659ffe43d994f4970b46a78f56,b22668bfa945c357c71682ac9b59e936a044bc3b..977921d90c65ea94b40cb7f8332246bf77c0f215
@@@ -1440,9 -1440,8 +1440,9 @@@ int refresh_index(struct index_state *i
                        continue;
                }
  
-               replace_index_entry(istate, i, new);
+               replace_index_entry(istate, i, new_entry);
        }
 +      trace_performance_since(start, "refresh index");
        return has_errors;
  }
  
diff --cc remote.c
Simple merge
diff --cc sequencer.c
Simple merge
diff --cc sha1_file.c
index 826d7a0ae377445c117a646ef26f79dc02785122,2288bb75cd75c5c366ea86fbd35896cc306a59ee..1b94f39c4c5653b090d5dbecf0cf7a785b0556bb
@@@ -804,11 -805,11 +804,11 @@@ int check_sha1_signature(const unsigne
                return -1;
  
        /* Generate the header */
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(obj_type), size) + 1;
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(obj_type), size) + 1;
  
        /* Sha1.. */
 -      git_SHA1_Init(&c);
 -      git_SHA1_Update(&c, hdr, hdrlen);
 +      the_hash_algo->init_fn(&c);
 +      the_hash_algo->update_fn(&c, hdr, hdrlen);
        for (;;) {
                char buf[1024 * 16];
                ssize_t readlen = read_istream(st, buf, sizeof(buf));
@@@ -1339,8 -1317,8 +1339,8 @@@ int pretend_object_file(void *buf, unsi
  {
        struct cached_object *co;
  
-       hash_object_file(buf, len, typename(type), oid);
 -      hash_sha1_file(buf, len, type_name(type), sha1);
 -      if (has_sha1_file(sha1) || find_cached_object(sha1))
++      hash_object_file(buf, len, type_name(type), oid);
 +      if (has_sha1_file(oid->hash) || find_cached_object(oid->hash))
                return 0;
        ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
        co = &cached_objects[cached_object_nr++];
@@@ -1709,13 -1678,13 +1709,13 @@@ int force_object_loose(const struct obj
        int hdrlen;
        int ret;
  
 -      if (has_loose_object(sha1))
 +      if (has_loose_object(oid->hash))
                return 0;
 -      buf = read_object(sha1, &type, &len);
 +      buf = read_object(oid->hash, &type, &len);
        if (!buf)
 -              return error("cannot read sha1_file for %s", sha1_to_hex(sha1));
 +              return error("cannot read sha1_file for %s", oid_to_hex(oid));
-       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), len) + 1;
+       hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", type_name(type), len) + 1;
 -      ret = write_loose_object(sha1, hdr, hdrlen, buf, len, mtime);
 +      ret = write_loose_object(oid, hdr, hdrlen, buf, len, mtime);
        free(buf);
  
        return ret;
@@@ -1798,9 -1767,9 +1798,9 @@@ static int index_mem(struct object_id *
        }
  
        if (write_object)
-               ret = write_object_file(buf, size, typename(type), oid);
 -              ret = write_sha1_file(buf, size, type_name(type), oid->hash);
++              ret = write_object_file(buf, size, type_name(type), oid);
        else
-               ret = hash_object_file(buf, size, typename(type), oid);
 -              ret = hash_sha1_file(buf, size, type_name(type), oid->hash);
++              ret = hash_object_file(buf, size, type_name(type), oid);
        if (re_allocated)
                free(buf);
        return ret;
@@@ -1817,14 -1786,14 +1817,14 @@@ static int index_stream_convert_blob(st
        assert(would_convert_to_git_filter_fd(path));
  
        convert_to_git_filter_fd(&the_index, path, fd, &sbuf,
 -                               get_safe_crlf(flags));
 +                               get_conv_flags(flags));
  
        if (write_object)
-               ret = write_object_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
 -              ret = write_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 -                                    oid->hash);
++              ret = write_object_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 +                                      oid);
        else
-               ret = hash_object_file(sbuf.buf, sbuf.len, typename(OBJ_BLOB),
 -              ret = hash_sha1_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 -                                   oid->hash);
++              ret = hash_object_file(sbuf.buf, sbuf.len, type_name(OBJ_BLOB),
 +                                     oid);
        strbuf_release(&sbuf);
        return ret;
  }
diff --cc split-index.c
Simple merge
diff --cc unpack-trees.c
Simple merge