Skip to content

Commit

Permalink
Merge branch 'ab/misc-cleanup'
Browse files Browse the repository at this point in the history
Code clean-up.

* ab/misc-cleanup:
  alloc.[ch]: remove alloc_report() function
  object-store.h: remove unused has_sha1_file*()
  pack-bitmap-write: remove unused bitmap_reset() function
  xdiff/xmacros.h: remove unused XDL_PTRFREE
  configure.ac: remove USE_PIC comment
  run-command.h: remove always unused "clean_on_exit_handler_cbdata"
  • Loading branch information
gitster committed May 11, 2022
2 parents e8005e4 + 0b75e5b commit 88cbd17
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 52 deletions.
21 changes: 0 additions & 21 deletions alloc.c
Expand Up @@ -27,7 +27,6 @@ union any_object {
};

struct alloc_state {
int count; /* total number of nodes allocated */
int nr; /* number of nodes left in current allocation */
void *p; /* first free node in current allocation */

Expand Down Expand Up @@ -63,7 +62,6 @@ static inline void *alloc_node(struct alloc_state *s, size_t node_size)
s->slabs[s->slab_nr++] = s->p;
}
s->nr--;
s->count++;
ret = s->p;
s->p = (char *)s->p + node_size;
memset(ret, 0, node_size);
Expand Down Expand Up @@ -122,22 +120,3 @@ void *alloc_commit_node(struct repository *r)
init_commit_node(c);
return c;
}

static void report(const char *name, unsigned int count, size_t size)
{
fprintf(stderr, "%10s: %8u (%"PRIuMAX" kB)\n",
name, count, (uintmax_t) size);
}

#define REPORT(name, type) \
report(#name, r->parsed_objects->name##_state->count, \
r->parsed_objects->name##_state->count * sizeof(type) >> 10)

void alloc_report(struct repository *r)
{
REPORT(blob, struct blob);
REPORT(tree, struct tree);
REPORT(commit, struct commit);
REPORT(tag, struct tag);
REPORT(object, union any_object);
}
1 change: 0 additions & 1 deletion alloc.h
Expand Up @@ -13,7 +13,6 @@ void init_commit_node(struct commit *c);
void *alloc_commit_node(struct repository *r);
void *alloc_tag_node(struct repository *r);
void *alloc_object_node(struct repository *r);
void alloc_report(struct repository *r);

struct alloc_state *allocate_alloc_state(void);
void clear_alloc_state(struct alloc_state *s);
Expand Down
3 changes: 0 additions & 3 deletions configure.ac
Expand Up @@ -1189,9 +1189,6 @@ AC_COMPILE_IFELSE([BSD_SYSCTL_SRC],
GIT_CONF_SUBST([HAVE_BSD_SYSCTL])

## Other checks.
# Define USE_PIC if you need the main git objects to be built with -fPIC
# in order to build and link perl/Git.so. x86-64 seems to need this.
#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows. By default, symrefs are still used.
#
Expand Down
15 changes: 0 additions & 15 deletions contrib/coccinelle/the_repository.pending.cocci
Expand Up @@ -11,21 +11,6 @@ expression G;
+ repo_read_object_file(the_repository,
E, F, G)

@@
expression E;
@@
- has_sha1_file(
+ repo_has_sha1_file(the_repository,
E)

@@
expression E;
expression F;
@@
- has_sha1_file_with_flags(
+ repo_has_sha1_file_with_flags(the_repository,
E)

@@
expression E;
@@
Expand Down
5 changes: 0 additions & 5 deletions ewah/bitmap.c
Expand Up @@ -216,11 +216,6 @@ int bitmap_is_subset(struct bitmap *self, struct bitmap *other)
return 0;
}

void bitmap_reset(struct bitmap *bitmap)
{
memset(bitmap->words, 0x0, bitmap->word_alloc * sizeof(eword_t));
}

void bitmap_free(struct bitmap *bitmap)
{
if (bitmap == NULL)
Expand Down
1 change: 0 additions & 1 deletion ewah/ewok.h
Expand Up @@ -177,7 +177,6 @@ struct bitmap *bitmap_dup(const struct bitmap *src);
void bitmap_set(struct bitmap *self, size_t pos);
void bitmap_unset(struct bitmap *self, size_t pos);
int bitmap_get(struct bitmap *self, size_t pos);
void bitmap_reset(struct bitmap *self);
void bitmap_free(struct bitmap *self);
int bitmap_equals(struct bitmap *self, struct bitmap *other);
int bitmap_is_subset(struct bitmap *self, struct bitmap *other);
Expand Down
4 changes: 0 additions & 4 deletions object-store.h
Expand Up @@ -312,10 +312,6 @@ int has_object(struct repository *r, const struct object_id *oid,
* These functions can be removed once all callers have migrated to
* has_object() and/or oid_object_info_extended().
*/
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
#define has_sha1_file_with_flags(sha1, flags) repo_has_sha1_file_with_flags(the_repository, sha1, flags)
#define has_sha1_file(sha1) repo_has_sha1_file(the_repository, sha1)
#endif
int repo_has_object_file(struct repository *r, const struct object_id *oid);
int repo_has_object_file_with_flags(struct repository *r,
const struct object_id *oid, int flags);
Expand Down
1 change: 0 additions & 1 deletion run-command.h
Expand Up @@ -142,7 +142,6 @@ struct child_process {
unsigned clean_on_exit:1;
unsigned wait_after_clean:1;
void (*clean_on_exit_handler)(struct child_process *process);
void *clean_on_exit_handler_cbdata;
};

#define CHILD_PROCESS_INIT { \
Expand Down
1 change: 0 additions & 1 deletion xdiff/xmacros.h
Expand Up @@ -34,7 +34,6 @@
#define XDL_ADDBITS(v,b) ((v) + ((v) >> (b)))
#define XDL_MASKBITS(b) ((1UL << (b)) - 1)
#define XDL_HASHLONG(v,b) (XDL_ADDBITS((unsigned long)(v), b) & XDL_MASKBITS(b))
#define XDL_PTRFREE(p) do { if (p) { xdl_free(p); (p) = NULL; } } while (0)
#define XDL_LE32_PUT(p, v) \
do { \
unsigned char *__p = (unsigned char *) (p); \
Expand Down

0 comments on commit 88cbd17

Please sign in to comment.