Skip to content

Commit

Permalink
Fix a bunch of pointer declarations (codestyle)
Browse files Browse the repository at this point in the history
Essentially; s/type* /type */ as per the coding guidelines.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
felipec authored and gitster committed May 1, 2009
1 parent 75b4406 commit 4b25d09
Show file tree
Hide file tree
Showing 25 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions alias.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int split_cmdline(char *cmdline, const char ***argv)
int src, dst, count = 0, size = 16;
char quoted = 0;

*argv = xmalloc(sizeof(char*) * size);
*argv = xmalloc(sizeof(char *) * size);

/* split alias_string */
(*argv)[count++] = cmdline;
Expand All @@ -40,7 +40,7 @@ int split_cmdline(char *cmdline, const char ***argv)
; /* skip */
if (count >= size) {
size += 16;
*argv = xrealloc(*argv, sizeof(char*) * size);
*argv = xrealloc(*argv, sizeof(char *) * size);
}
(*argv)[count++] = cmdline + dst;
} else if (!quoted && (c == '\'' || c == '"')) {
Expand Down
2 changes: 1 addition & 1 deletion alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ DEFINE_ALLOCATOR(object, union any_object)
#define SZ_FMT "%zu"
#endif

static void report(const char* name, unsigned int count, size_t size)
static void report(const char *name, unsigned int count, size_t size)
{
fprintf(stderr, "%10s: %8u (" SZ_FMT " kB)\n", name, count, size);
}
Expand Down
4 changes: 2 additions & 2 deletions attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
if (is_macro)
res->u.attr = git_attr(name, namelen);
else {
res->u.pattern = (char*)&(res->state[num_attr]);
res->u.pattern = (char *)&(res->state[num_attr]);
memcpy(res->u.pattern, name, namelen);
res->u.pattern[namelen] = 0;
}
Expand Down Expand Up @@ -275,7 +275,7 @@ static void free_attr_elem(struct attr_stack *e)
setto == ATTR__UNKNOWN)
;
else
free((char*) setto);
free((char *) setto);
}
free(a);
}
Expand Down
8 changes: 4 additions & 4 deletions builtin-blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
* Prepare mmfile that contains only the lines in ent.
*/
cp = nth_line(sb, ent->lno);
file_o.ptr = (char*) cp;
file_o.ptr = (char *) cp;
cnt = ent->num_lines;

while (cnt && cp < sb->final_buf + sb->final_buf_size) {
Expand Down Expand Up @@ -1704,7 +1704,7 @@ static int prepare_lines(struct scoreboard *sb)
while (len--) {
if (bol) {
sb->lineno = xrealloc(sb->lineno,
sizeof(int* ) * (num + 1));
sizeof(int *) * (num + 1));
sb->lineno[num] = buf - sb->final_buf;
bol = 0;
}
Expand All @@ -1714,7 +1714,7 @@ static int prepare_lines(struct scoreboard *sb)
}
}
sb->lineno = xrealloc(sb->lineno,
sizeof(int* ) * (num + incomplete + 1));
sizeof(int *) * (num + incomplete + 1));
sb->lineno[num + incomplete] = buf - sb->final_buf;
sb->num_lines = num + incomplete;
return sb->num_lines;
Expand Down Expand Up @@ -1889,7 +1889,7 @@ static const char *parse_loc(const char *spec,
return spec;

/* it could be a regexp of form /.../ */
for (term = (char*) spec + 1; *term && *term != '/'; term++) {
for (term = (char *) spec + 1; *term && *term != '/'; term++) {
if (*term == '\\')
term++;
}
Expand Down
4 changes: 2 additions & 2 deletions builtin-checkout-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static int checkout_file(const char *name, int prefix_length)
static void checkout_all(const char *prefix, int prefix_length)
{
int i, errs = 0;
struct cache_entry* last_ce = NULL;
struct cache_entry *last_ce = NULL;

for (i = 0; i < active_nr ; i++) {
struct cache_entry *ce = active_cache[i];
Expand Down Expand Up @@ -278,7 +278,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
p = prefix_path(prefix, prefix_length, arg);
checkout_file(p, prefix_length);
if (p < arg || p > arg + strlen(arg))
free((char*)p);
free((char *)p);
}

if (read_from_stdin) {
Expand Down
4 changes: 2 additions & 2 deletions builtin-describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
die("--long is incompatible with --abbrev=0");

if (contains) {
const char **args = xmalloc((7 + argc) * sizeof(char*));
const char **args = xmalloc((7 + argc) * sizeof(char *));
int i = 0;
args[i++] = "name-rev";
args[i++] = "--name-only";
Expand All @@ -349,7 +349,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
args[i++] = s;
}
}
memcpy(args + i, argv, argc * sizeof(char*));
memcpy(args + i, argv, argc * sizeof(char *));
args[i + argc] = NULL;
return cmd_name_rev(i + argc, args, prefix);
}
Expand Down
2 changes: 1 addition & 1 deletion builtin-fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static void mark_common(struct commit *commit,
Get the next rev to send, ignoring the common.
*/

static const unsigned char* get_rev(void)
static const unsigned char *get_rev(void)
{
struct commit *commit = NULL;

Expand Down
6 changes: 3 additions & 3 deletions builtin-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int check_emacsclient_version(void)
return 0;
}

static void exec_woman_emacs(const char* path, const char *page)
static void exec_woman_emacs(const char *path, const char *page)
{
if (!check_emacsclient_version()) {
/* This works only with emacsclient version >= 22. */
Expand All @@ -128,7 +128,7 @@ static void exec_woman_emacs(const char* path, const char *page)
}
}

static void exec_man_konqueror(const char* path, const char *page)
static void exec_man_konqueror(const char *path, const char *page)
{
const char *display = getenv("DISPLAY");
if (display && *display) {
Expand Down Expand Up @@ -156,7 +156,7 @@ static void exec_man_konqueror(const char* path, const char *page)
}
}

static void exec_man_man(const char* path, const char *page)
static void exec_man_man(const char *path, const char *page)
{
if (!path)
path = "man";
Expand Down
6 changes: 3 additions & 3 deletions builtin-update-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
report("add '%s'", path);
free_return:
if (p < path || p > path + strlen(path))
free((char*)p);
free((char *)p);
}

static void read_index_info(int line_termination)
Expand Down Expand Up @@ -509,7 +509,7 @@ static int do_unresolve(int ac, const char **av,
const char *p = prefix_path(prefix, prefix_length, arg);
err |= unresolve_one(p);
if (p < arg || p > arg + strlen(arg))
free((char*)p);
free((char *)p);
}
return err;
}
Expand Down Expand Up @@ -712,7 +712,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
if (set_executable_bit)
chmod_path(set_executable_bit, p);
if (p < path || p > path + strlen(path))
free((char*)p);
free((char *)p);
}
if (read_from_stdin) {
struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
Expand Down
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ extern struct packed_git *find_sha1_pack(const unsigned char *sha1,

extern void pack_report(void);
extern int open_pack_index(struct packed_git *);
extern unsigned char* use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
extern void close_pack_windows(struct packed_git *);
extern void unuse_pack(struct pack_window **);
extern void free_pack_by_name(const char *);
Expand Down
4 changes: 2 additions & 2 deletions combine-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
path = q->queue[i]->two->path;
len = strlen(path);
p = xmalloc(combine_diff_path_size(num_parent, len));
p->path = (char*) &(p->parent[num_parent]);
p->path = (char *) &(p->parent[num_parent]);
memcpy(p->path, path, len);
p->path[len] = 0;
p->len = len;
Expand Down Expand Up @@ -1063,7 +1063,7 @@ void diff_tree_combined_merge(const unsigned char *sha1,
for (parents = commit->parents, num_parent = 0;
parents;
parents = parents->next, num_parent++)
hashcpy((unsigned char*)(parent + num_parent),
hashcpy((unsigned char *)(parent + num_parent),
parents->item->object.sha1);
diff_tree_combined(sha1, parent, num_parent, dense, rev);
}
2 changes: 1 addition & 1 deletion compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ static char **get_path_split(void)
if (!n)
return NULL;

path = xmalloc((n+1)*sizeof(char*));
path = xmalloc((n+1)*sizeof(char *));
p = envpath;
i = 0;
do {
Expand Down
30 changes: 15 additions & 15 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,24 +724,24 @@ int git_config(config_fn_t fn, void *data)

static struct {
int baselen;
char* key;
char *key;
int do_not_match;
regex_t* value_regex;
regex_t *value_regex;
int multi_replace;
size_t offset[MAX_MATCHES];
enum { START, SECTION_SEEN, SECTION_END_SEEN, KEY_SEEN } state;
int seen;
} store;

static int matches(const char* key, const char* value)
static int matches(const char *key, const char *value)
{
return !strcmp(key, store.key) &&
(store.value_regex == NULL ||
(store.do_not_match ^
!regexec(store.value_regex, value, 0, NULL, 0)));
}

static int store_aux(const char* key, const char* value, void *cb)
static int store_aux(const char *key, const char *value, void *cb)
{
const char *ep;
size_t section_len;
Expand Down Expand Up @@ -810,7 +810,7 @@ static int write_error(const char *filename)
return 4;
}

static int store_write_section(int fd, const char* key)
static int store_write_section(int fd, const char *key)
{
const char *dot;
int i, success;
Expand All @@ -835,7 +835,7 @@ static int store_write_section(int fd, const char* key)
return success;
}

static int store_write_pair(int fd, const char* key, const char* value)
static int store_write_pair(int fd, const char *key, const char *value)
{
int i, success;
int length = strlen(key + store.baselen + 1);
Expand Down Expand Up @@ -883,8 +883,8 @@ static int store_write_pair(int fd, const char* key, const char* value)
return success;
}

static ssize_t find_beginning_of_line(const char* contents, size_t size,
size_t offset_, int* found_bracket)
static ssize_t find_beginning_of_line(const char *contents, size_t size,
size_t offset_, int *found_bracket)
{
size_t equal_offset = size, bracket_offset = size;
ssize_t offset;
Expand All @@ -909,7 +909,7 @@ static ssize_t find_beginning_of_line(const char* contents, size_t size,
return offset;
}

int git_config_set(const char* key, const char* value)
int git_config_set(const char *key, const char *value)
{
return git_config_set_multivar(key, value, NULL, 0);
}
Expand Down Expand Up @@ -937,15 +937,15 @@ int git_config_set(const char* key, const char* value)
* - the config file is removed and the lock file rename()d to it.
*
*/
int git_config_set_multivar(const char* key, const char* value,
const char* value_regex, int multi_replace)
int git_config_set_multivar(const char *key, const char *value,
const char *value_regex, int multi_replace)
{
int i, dot;
int fd = -1, in_fd;
int ret;
char* config_filename;
char *config_filename;
struct lock_file *lock = NULL;
const char* last_dot = strrchr(key, '.');
const char *last_dot = strrchr(key, '.');

if (config_exclusive_filename)
config_filename = xstrdup(config_exclusive_filename);
Expand Down Expand Up @@ -1026,13 +1026,13 @@ int git_config_set_multivar(const char* key, const char* value,
goto out_free;
}

store.key = (char*)key;
store.key = (char *)key;
if (!store_write_section(fd, key) ||
!store_write_pair(fd, key, value))
goto write_err_out;
} else {
struct stat st;
char* contents;
char *contents;
size_t contents_sz, copy_begin, copy_end;
int i, new_line = 0;

Expand Down
6 changes: 3 additions & 3 deletions contrib/convert-objects/convert-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static void convert_ascii_sha1(void *buffer)
struct entry *entry;

if (get_sha1_hex(buffer, sha1))
die("expected sha1, got '%s'", (char*) buffer);
die("expected sha1, got '%s'", (char *) buffer);
entry = convert_entry(sha1);
memcpy(buffer, sha1_to_hex(entry->new_sha1), 40);
}
Expand Down Expand Up @@ -100,7 +100,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
if (!slash) {
newlen += sprintf(new + newlen, "%o %s", mode, path);
new[newlen++] = '\0';
hashcpy((unsigned char*)new + newlen, (unsigned char *) buffer + len - 20);
hashcpy((unsigned char *)new + newlen, (unsigned char *) buffer + len - 20);
newlen += 20;

used += len;
Expand Down Expand Up @@ -271,7 +271,7 @@ static void convert_commit(void *buffer, unsigned long size, unsigned char *resu
unsigned long orig_size = size;

if (memcmp(buffer, "tree ", 5))
die("Bad commit '%s'", (char*) buffer);
die("Bad commit '%s'", (char *) buffer);
convert_ascii_sha1((char *) buffer + 5);
buffer = (char *) buffer + 46; /* "tree " + "hex sha1" + "\n" */
while (!memcmp(buffer, "parent ", 7)) {
Expand Down
2 changes: 1 addition & 1 deletion diff-no-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void diff_no_index(struct rev_info *revs,
if (prefix) {
int len = strlen(prefix);

revs->diffopt.paths = xcalloc(2, sizeof(char*));
revs->diffopt.paths = xcalloc(2, sizeof(char *));
for (i = 0; i < 2; i++) {
const char *p = argv[argc - 2 + i];
/*
Expand Down
4 changes: 2 additions & 2 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ static void fill_print_name(struct diffstat_file *file)
file->print_name = pname;
}

static void show_stats(struct diffstat_t* data, struct diff_options *options)
static void show_stats(struct diffstat_t *data, struct diff_options *options)
{
int i, len, add, del, adds = 0, dels = 0;
int max_change = 0, max_len = 0;
Expand Down Expand Up @@ -1025,7 +1025,7 @@ static void show_shortstats(struct diffstat_t* data, struct diff_options *option
total_files, adds, dels);
}

static void show_numstat(struct diffstat_t* data, struct diff_options *options)
static void show_numstat(struct diffstat_t *data, struct diff_options *options)
{
int i;

Expand Down
2 changes: 1 addition & 1 deletion dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void add_exclude(const char *string, const char *base,
if (len && string[len - 1] == '/') {
char *s;
x = xmalloc(sizeof(*x) + len);
s = (char*)(x+1);
s = (char *)(x+1);
memcpy(s, string, len - 1);
s[len - 1] = '\0';
string = s;
Expand Down
Loading

0 comments on commit 4b25d09

Please sign in to comment.