Skip to content

Commit e9b9cc5

Browse files
jeffhostetlergitster
authored andcommitted
cache-tree/blame: avoid reusing the DEBUG constant
In MS Visual C, the `DEBUG` constant is set automatically whenever compiling with debug information. This is clearly not what was intended in `cache-tree.c` nor in `builtin/blame.c`, so let's use a less ambiguous name there. Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdda1ac commit e9b9cc5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

builtin/blame.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ static size_t blame_date_width;
5959

6060
static struct string_list mailmap = STRING_LIST_INIT_NODUP;
6161

62-
#ifndef DEBUG
63-
#define DEBUG 0
62+
#ifndef DEBUG_BLAME
63+
#define DEBUG_BLAME 0
6464
#endif
6565

6666
static unsigned blame_move_score;
@@ -1062,7 +1062,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
10621062
if (blame_copy_score)
10631063
sb.copy_score = blame_copy_score;
10641064

1065-
sb.debug = DEBUG;
1065+
sb.debug = DEBUG_BLAME;
10661066
sb.on_sanity_fail = &sanity_check_on_fail;
10671067

10681068
sb.show_root = show_root;

cache-tree.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include "object-store.h"
77
#include "replace-object.h"
88

9-
#ifndef DEBUG
10-
#define DEBUG 0
9+
#ifndef DEBUG_CACHE_TREE
10+
#define DEBUG_CACHE_TREE 0
1111
#endif
1212

1313
struct cache_tree *cache_tree(void)
@@ -111,7 +111,7 @@ static int do_invalidate_path(struct cache_tree *it, const char *path)
111111
int namelen;
112112
struct cache_tree_sub *down;
113113

114-
#if DEBUG
114+
#if DEBUG_CACHE_TREE
115115
fprintf(stderr, "cache-tree invalidate <%s>\n", path);
116116
#endif
117117

@@ -398,7 +398,7 @@ static int update_one(struct cache_tree *it,
398398
strbuf_addf(&buffer, "%o %.*s%c", mode, entlen, path + baselen, '\0');
399399
strbuf_add(&buffer, oid->hash, the_hash_algo->rawsz);
400400

401-
#if DEBUG
401+
#if DEBUG_CACHE_TREE
402402
fprintf(stderr, "cache-tree update-one %o %.*s\n",
403403
mode, entlen, path + baselen);
404404
#endif
@@ -421,7 +421,7 @@ static int update_one(struct cache_tree *it,
421421

422422
strbuf_release(&buffer);
423423
it->entry_count = to_invalidate ? -1 : i - *skip_count;
424-
#if DEBUG
424+
#if DEBUG_CACHE_TREE
425425
fprintf(stderr, "cache-tree update-one (%d ent, %d subtree) %s\n",
426426
it->entry_count, it->subtree_nr,
427427
oid_to_hex(&it->oid));
@@ -462,7 +462,7 @@ static void write_one(struct strbuf *buffer, struct cache_tree *it,
462462
strbuf_add(buffer, path, pathlen);
463463
strbuf_addf(buffer, "%c%d %d\n", 0, it->entry_count, it->subtree_nr);
464464

465-
#if DEBUG
465+
#if DEBUG_CACHE_TREE
466466
if (0 <= it->entry_count)
467467
fprintf(stderr, "cache-tree <%.*s> (%d ent, %d subtree) %s\n",
468468
pathlen, path, it->entry_count, it->subtree_nr,
@@ -536,7 +536,7 @@ static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)
536536
size -= rawsz;
537537
}
538538

539-
#if DEBUG
539+
#if DEBUG_CACHE_TREE
540540
if (0 <= it->entry_count)
541541
fprintf(stderr, "cache-tree <%s> (%d ent, %d subtree) %s\n",
542542
*buffer, it->entry_count, subtree_nr,

0 commit comments

Comments
 (0)