Fix a bunch of pointer declarations (codestyle)
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>
Felipe Contreras committed
May 1, 2009 at 12:06 UTC
4b25d091ba53c758fae0096b8c0662371857b9d9
25 files changed
+64
-64
alias.c
+2
-2
@@ -27,7 +27,7 @@ int split_cmdline(char *cmdline, const char ***argv)
27
int src, dst, count = 0, size = 16;
28
char quoted = 0;
29
30
- *argv = xmalloc(sizeof(char*) * size);
30
+ *argv = xmalloc(sizeof(char *) * size);
31
32
/* split alias_string */
33
(*argv)[count++] = cmdline;
@@ -40,7 +40,7 @@ int split_cmdline(char *cmdline, const char ***argv)
40
; /* skip */
41
if (count >= size) {
42
size += 16;
43
- *argv = xrealloc(*argv, sizeof(char*) * size);
43
+ *argv = xrealloc(*argv, sizeof(char *) * size);
44
}
45
(*argv)[count++] = cmdline + dst;
46
} else if (!quoted && (c == '\'' || c == '"')) {
alloc.c
+1
-1
@@ -57,7 +57,7 @@ DEFINE_ALLOCATOR(object, union any_object)
57
#define SZ_FMT "%zu"
58
#endif
59
60
-static void report(const char* name, unsigned int count, size_t size)
60
+static void report(const char *name, unsigned int count, size_t size)
61
{
62
fprintf(stderr, "%10s: %8u (" SZ_FMT " kB)\n", name, count, size);
63
}
attr.c
+2
-2
@@ -224,7 +224,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
224
if (is_macro)
225
res->u.attr = git_attr(name, namelen);
226
else {
227
- res->u.pattern = (char*)&(res->state[num_attr]);
227
+ res->u.pattern = (char *)&(res->state[num_attr]);
228
memcpy(res->u.pattern, name, namelen);
229
res->u.pattern[namelen] = 0;
230
}
@@ -275,7 +275,7 @@ static void free_attr_elem(struct attr_stack *e)
275
setto == ATTR__UNKNOWN)
276
;
277
else
278
- free((char*) setto);
278
+ free((char *) setto);
279
}
280
free(a);
281
}
builtin-blame.c
+4
-4
@@ -873,7 +873,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
873
* Prepare mmfile that contains only the lines in ent.
874
*/
875
cp = nth_line(sb, ent->lno);
876
- file_o.ptr = (char*) cp;
876
+ file_o.ptr = (char *) cp;
877
cnt = ent->num_lines;
878
879
while (cnt && cp < sb->final_buf + sb->final_buf_size) {
@@ -1704,7 +1704,7 @@ static int prepare_lines(struct scoreboard *sb)
1704
while (len--) {
1705
if (bol) {
1706
sb->lineno = xrealloc(sb->lineno,
1707
- sizeof(int* ) * (num + 1));
1707
+ sizeof(int *) * (num + 1));
1708
sb->lineno[num] = buf - sb->final_buf;
1709
bol = 0;
1710
}
@@ -1714,7 +1714,7 @@ static int prepare_lines(struct scoreboard *sb)
1714
}
1715
}
1716
sb->lineno = xrealloc(sb->lineno,
1717
- sizeof(int* ) * (num + incomplete + 1));
1717
+ sizeof(int *) * (num + incomplete + 1));
1718
sb->lineno[num + incomplete] = buf - sb->final_buf;
1719
sb->num_lines = num + incomplete;
1720
return sb->num_lines;
@@ -1889,7 +1889,7 @@ static const char *parse_loc(const char *spec,
1889
return spec;
1890
1891
/* it could be a regexp of form /.../ */
1892
- for (term = (char*) spec + 1; *term && *term != '/'; term++) {
1892
+ for (term = (char *) spec + 1; *term && *term != '/'; term++) {
1893
if (*term == '\\')
1894
term++;
1895
}
builtin-checkout-index.c
+2
-2
@@ -124,7 +124,7 @@ static int checkout_file(const char *name, int prefix_length)
124
static void checkout_all(const char *prefix, int prefix_length)
125
{
126
int i, errs = 0;
127
- struct cache_entry* last_ce = NULL;
127
+ struct cache_entry *last_ce = NULL;
128
129
for (i = 0; i < active_nr ; i++) {
130
struct cache_entry *ce = active_cache[i];
@@ -278,7 +278,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
278
p = prefix_path(prefix, prefix_length, arg);
279
checkout_file(p, prefix_length);
280
if (p < arg || p > arg + strlen(arg))
281
- free((char*)p);
281
+ free((char *)p);
282
}
283
284
if (read_from_stdin) {
builtin-describe.c
+2
-2
@@ -334,7 +334,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
334
die("--long is incompatible with --abbrev=0");
335
336
if (contains) {
337
- const char **args = xmalloc((7 + argc) * sizeof(char*));
337
+ const char **args = xmalloc((7 + argc) * sizeof(char *));
338
int i = 0;
339
args[i++] = "name-rev";
340
args[i++] = "--name-only";
@@ -349,7 +349,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
349
args[i++] = s;
350
}
351
}
352
- memcpy(args + i, argv, argc * sizeof(char*));
352
+ memcpy(args + i, argv, argc * sizeof(char *));
353
args[i + argc] = NULL;
354
return cmd_name_rev(i + argc, args, prefix);
355
}
builtin-fetch-pack.c
+1
-1
@@ -111,7 +111,7 @@ static void mark_common(struct commit *commit,
111
Get the next rev to send, ignoring the common.
112
*/
113
114
-static const unsigned char* get_rev(void)
114
+static const unsigned char *get_rev(void)
115
{
116
struct commit *commit = NULL;
117
builtin-help.c
+3
-3
@@ -114,7 +114,7 @@ static int check_emacsclient_version(void)
114
return 0;
115
}
116
117
-static void exec_woman_emacs(const char* path, const char *page)
117
+static void exec_woman_emacs(const char *path, const char *page)
118
{
119
if (!check_emacsclient_version()) {
120
/* This works only with emacsclient version >= 22. */
@@ -128,7 +128,7 @@ static void exec_woman_emacs(const char* path, const char *page)
128
}
129
}
130
131
-static void exec_man_konqueror(const char* path, const char *page)
131
+static void exec_man_konqueror(const char *path, const char *page)
132
{
133
const char *display = getenv("DISPLAY");
134
if (display && *display) {
@@ -156,7 +156,7 @@ static void exec_man_konqueror(const char* path, const char *page)
156
}
157
}
158
159
-static void exec_man_man(const char* path, const char *page)
159
+static void exec_man_man(const char *path, const char *page)
160
{
161
if (!path)
162
path = "man";
builtin-update-index.c
+3
-3
@@ -292,7 +292,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
292
report("add '%s'", path);
293
free_return:
294
if (p < path || p > path + strlen(path))
295
- free((char*)p);
295
+ free((char *)p);
296
}
297
298
static void read_index_info(int line_termination)
@@ -509,7 +509,7 @@ static int do_unresolve(int ac, const char **av,
509
const char *p = prefix_path(prefix, prefix_length, arg);
510
err |= unresolve_one(p);
511
if (p < arg || p > arg + strlen(arg))
512
- free((char*)p);
512
+ free((char *)p);
513
}
514
return err;
515
}
@@ -712,7 +712,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
712
if (set_executable_bit)
713
chmod_path(set_executable_bit, p);
714
if (p < path || p > path + strlen(path))
715
- free((char*)p);
715
+ free((char *)p);
716
}
717
if (read_from_stdin) {
718
struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;
cache.h
+1
-1
@@ -846,7 +846,7 @@ extern struct packed_git *find_sha1_pack(const unsigned char *sha1,
846
847
extern void pack_report(void);
848
extern int open_pack_index(struct packed_git *);
849
-extern unsigned char* use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
849
+extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned int *);
850
extern void close_pack_windows(struct packed_git *);
851
extern void unuse_pack(struct pack_window **);
852
extern void free_pack_by_name(const char *);
combine-diff.c
+2
-2
@@ -24,7 +24,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
24
path = q->queue[i]->two->path;
25
len = strlen(path);
26
p = xmalloc(combine_diff_path_size(num_parent, len));
27
- p->path = (char*) &(p->parent[num_parent]);
27
+ p->path = (char *) &(p->parent[num_parent]);
28
memcpy(p->path, path, len);
29
p->path[len] = 0;
30
p->len = len;
@@ -1063,7 +1063,7 @@ void diff_tree_combined_merge(const unsigned char *sha1,
1063
for (parents = commit->parents, num_parent = 0;
1064
parents;
1065
parents = parents->next, num_parent++)
1066
- hashcpy((unsigned char*)(parent + num_parent),
1066
+ hashcpy((unsigned char *)(parent + num_parent),
1067
parents->item->object.sha1);
1068
diff_tree_combined(sha1, parent, num_parent, dense, rev);
1069
}
compat/mingw.c
+1
-1
@@ -562,7 +562,7 @@ static char **get_path_split(void)
562
if (!n)
563
return NULL;
564
565
- path = xmalloc((n+1)*sizeof(char*));
565
+ path = xmalloc((n+1)*sizeof(char *));
566
p = envpath;
567
i = 0;
568
do {
config.c
+15
-15
@@ -724,16 +724,16 @@ int git_config(config_fn_t fn, void *data)
724
725
static struct {
726
int baselen;
727
- char* key;
727
+ char *key;
728
int do_not_match;
729
- regex_t* value_regex;
729
+ regex_t *value_regex;
730
int multi_replace;
731
size_t offset[MAX_MATCHES];
732
enum { START, SECTION_SEEN, SECTION_END_SEEN, KEY_SEEN } state;
733
int seen;
734
} store;
735
736
-static int matches(const char* key, const char* value)
736
+static int matches(const char *key, const char *value)
737
{
738
return !strcmp(key, store.key) &&
739
(store.value_regex == NULL ||
@@ -741,7 +741,7 @@ static int matches(const char* key, const char* value)
741
!regexec(store.value_regex, value, 0, NULL, 0)));
742
}
743
744
-static int store_aux(const char* key, const char* value, void *cb)
744
+static int store_aux(const char *key, const char *value, void *cb)
745
{
746
const char *ep;
747
size_t section_len;
@@ -810,7 +810,7 @@ static int write_error(const char *filename)
810
return 4;
811
}
812
813
-static int store_write_section(int fd, const char* key)
813
+static int store_write_section(int fd, const char *key)
814
{
815
const char *dot;
816
int i, success;
@@ -835,7 +835,7 @@ static int store_write_section(int fd, const char* key)
835
return success;
836
}
837
838
-static int store_write_pair(int fd, const char* key, const char* value)
838
+static int store_write_pair(int fd, const char *key, const char *value)
839
{
840
int i, success;
841
int length = strlen(key + store.baselen + 1);
@@ -883,8 +883,8 @@ static int store_write_pair(int fd, const char* key, const char* value)
883
return success;
884
}
885
886
-static ssize_t find_beginning_of_line(const char* contents, size_t size,
887
- size_t offset_, int* found_bracket)
886
+static ssize_t find_beginning_of_line(const char *contents, size_t size,
887
+ size_t offset_, int *found_bracket)
888
{
889
size_t equal_offset = size, bracket_offset = size;
890
ssize_t offset;
@@ -909,7 +909,7 @@ contline:
909
return offset;
910
}
911
912
-int git_config_set(const char* key, const char* value)
912
+int git_config_set(const char *key, const char *value)
913
{
914
return git_config_set_multivar(key, value, NULL, 0);
915
}
@@ -937,15 +937,15 @@ int git_config_set(const char* key, const char* value)
937
* - the config file is removed and the lock file rename()d to it.
938
*
939
*/
940
-int git_config_set_multivar(const char* key, const char* value,
941
- const char* value_regex, int multi_replace)
940
+int git_config_set_multivar(const char *key, const char *value,
941
+ const char *value_regex, int multi_replace)
942
{
943
int i, dot;
944
int fd = -1, in_fd;
945
int ret;
946
- char* config_filename;
946
+ char *config_filename;
947
struct lock_file *lock = NULL;
948
- const char* last_dot = strrchr(key, '.');
948
+ const char *last_dot = strrchr(key, '.');
949
950
if (config_exclusive_filename)
951
config_filename = xstrdup(config_exclusive_filename);
@@ -1026,13 +1026,13 @@ int git_config_set_multivar(const char* key, const char* value,
1026
goto out_free;
1027
}
1028
1029
- store.key = (char*)key;
1029
+ store.key = (char *)key;
1030
if (!store_write_section(fd, key) ||
1031
!store_write_pair(fd, key, value))
1032
goto write_err_out;
1033
} else {
1034
struct stat st;
1035
- char* contents;
1035
+ char *contents;
1036
size_t contents_sz, copy_begin, copy_end;
1037
int i, new_line = 0;
1038
contrib/convert-objects/convert-objects.c
+3
-3
@@ -59,7 +59,7 @@ static void convert_ascii_sha1(void *buffer)
59
struct entry *entry;
60
61
if (get_sha1_hex(buffer, sha1))
62
- die("expected sha1, got '%s'", (char*) buffer);
62
+ die("expected sha1, got '%s'", (char *) buffer);
63
entry = convert_entry(sha1);
64
memcpy(buffer, sha1_to_hex(entry->new_sha1), 40);
65
}
@@ -100,7 +100,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
100
if (!slash) {
101
newlen += sprintf(new + newlen, "%o %s", mode, path);
102
new[newlen++] = '\0';
103
- hashcpy((unsigned char*)new + newlen, (unsigned char *) buffer + len - 20);
103
+ hashcpy((unsigned char *)new + newlen, (unsigned char *) buffer + len - 20);
104
newlen += 20;
105
106
used += len;
@@ -271,7 +271,7 @@ static void convert_commit(void *buffer, unsigned long size, unsigned char *resu
271
unsigned long orig_size = size;
272
273
if (memcmp(buffer, "tree ", 5))
274
- die("Bad commit '%s'", (char*) buffer);
274
+ die("Bad commit '%s'", (char *) buffer);
275
convert_ascii_sha1((char *) buffer + 5);
276
buffer = (char *) buffer + 46; /* "tree " + "hex sha1" + "\n" */
277
while (!memcmp(buffer, "parent ", 7)) {
diff-no-index.c
+1
-1
@@ -233,7 +233,7 @@ void diff_no_index(struct rev_info *revs,
233
if (prefix) {
234
int len = strlen(prefix);
235
236
- revs->diffopt.paths = xcalloc(2, sizeof(char*));
236
+ revs->diffopt.paths = xcalloc(2, sizeof(char *));
237
for (i = 0; i < 2; i++) {
238
const char *p = argv[argc - 2 + i];
239
/*
diff.c
+2
-2
@@ -876,7 +876,7 @@ static void fill_print_name(struct diffstat_file *file)
876
file->print_name = pname;
877
}
878
879
-static void show_stats(struct diffstat_t* data, struct diff_options *options)
879
+static void show_stats(struct diffstat_t *data, struct diff_options *options)
880
{
881
int i, len, add, del, adds = 0, dels = 0;
882
int max_change = 0, max_len = 0;
@@ -1025,7 +1025,7 @@ static void show_shortstats(struct diffstat_t* data, struct diff_options *option
1025
total_files, adds, dels);
1026
}
1027
1028
-static void show_numstat(struct diffstat_t* data, struct diff_options *options)
1028
+static void show_numstat(struct diffstat_t *data, struct diff_options *options)
1029
{
1030
int i;
1031
dir.c
+1
-1
@@ -156,7 +156,7 @@ void add_exclude(const char *string, const char *base,
156
if (len && string[len - 1] == '/') {
157
char *s;
158
x = xmalloc(sizeof(*x) + len);
159
- s = (char*)(x+1);
159
+ s = (char *)(x+1);
160
memcpy(s, string, len - 1);
161
s[len - 1] = '\0';
162
string = s;
fast-import.c
+7
-7
@@ -212,7 +212,7 @@ struct tree_content;
212
struct tree_entry
213
{
214
struct tree_content *tree;
215
- struct atom_str* name;
215
+ struct atom_str *name;
216
struct tree_entry_ms
217
{
218
uint16_t mode;
@@ -313,7 +313,7 @@ static unsigned int object_entry_alloc = 5000;
313
static struct object_entry_pool *blocks;
314
static struct object_entry *object_table[1 << 16];
315
static struct mark_set *marks;
316
-static const char* mark_file;
316
+static const char *mark_file;
317
318
/* Our last blob */
319
static struct last_object last_blob = { STRBUF_INIT, 0, 0, 0 };
@@ -672,7 +672,7 @@ static struct branch *lookup_branch(const char *name)
672
static struct branch *new_branch(const char *name)
673
{
674
unsigned int hc = hc_str(name, strlen(name)) % branch_table_sz;
675
- struct branch* b = lookup_branch(name);
675
+ struct branch *b = lookup_branch(name);
676
677
if (b)
678
die("Invalid attempt to create duplicate branch: %s", name);
@@ -1035,7 +1035,7 @@ static int store_object(
1035
git_SHA_CTX c;
1036
z_stream s;
1037
1038
- hdrlen = sprintf((char*)hdr,"%s %lu", typename(type),
1038
+ hdrlen = sprintf((char *)hdr,"%s %lu", typename(type),
1039
(unsigned long)dat->len) + 1;
1040
git_SHA1_Init(&c);
1041
git_SHA1_Update(&c, hdr, hdrlen);
@@ -1217,7 +1217,7 @@ static const char *get_mode(const char *str, uint16_t *modep)
1217
1218
static void load_tree(struct tree_entry *root)
1219
{
1220
- unsigned char* sha1 = root->versions[1].sha1;
1220
+ unsigned char *sha1 = root->versions[1].sha1;
1221
struct object_entry *myoe;
1222
struct tree_content *t;
1223
unsigned long size;
@@ -1258,8 +1258,8 @@ static void load_tree(struct tree_entry *root)
1258
e->versions[0].mode = e->versions[1].mode;
1259
e->name = to_atom(c, strlen(c));
1260
c += e->name->str_len + 1;
1261
- hashcpy(e->versions[0].sha1, (unsigned char*)c);
1262
- hashcpy(e->versions[1].sha1, (unsigned char*)c);
1261
+ hashcpy(e->versions[0].sha1, (unsigned char *)c);
1262
+ hashcpy(e->versions[1].sha1, (unsigned char *)c);
1263
c += 20;
1264
}
1265
free(buf);
git.c
+4
-4
@@ -47,7 +47,7 @@ static void commit_pager_choice(void) {
47
}
48
}
49
50
-static int handle_options(const char*** argv, int* argc, int* envchanged)
50
+static int handle_options(const char ***argv, int *argc, int *envchanged)
51
{
52
int handled = 0;
53
@@ -136,7 +136,7 @@ static int handle_alias(int *argcp, const char ***argv)
136
int envchanged = 0, ret = 0, saved_errno = errno;
137
const char *subdir;
138
int count, option_count;
139
- const char** new_argv;
139
+ const char **new_argv;
140
const char *alias_command;
141
char *alias_string;
142
int unused_nongit;
@@ -187,10 +187,10 @@ static int handle_alias(int *argcp, const char ***argv)
187
"trace: alias expansion: %s =>",
188
alias_command);
189
190
- new_argv = xrealloc(new_argv, sizeof(char*) *
190
+ new_argv = xrealloc(new_argv, sizeof(char *) *
191
(count + *argcp + 1));
192
/* insert after command name */
193
- memcpy(new_argv + count, *argv + 1, sizeof(char*) * *argcp);
193
+ memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp);
194
new_argv[count+*argcp] = NULL;
195
196
*argv = new_argv;
lockfile.c
+1
-1
@@ -109,7 +109,7 @@ static char *resolve_symlink(char *p, size_t s)
109
* link is a relative path, so I must replace the
110
* last element of p with it.
111
*/
112
- char *r = (char*)last_path_elm(p);
112
+ char *r = (char *)last_path_elm(p);
113
if (r - p + link_len < s)
114
strcpy(r, link);
115
else {
reflog-walk.c
+1
-1
@@ -241,7 +241,7 @@ void fake_reflog_parent(struct reflog_walk_info *info, struct commit *commit)
241
commit->object.flags &= ~(ADDED | SEEN | SHOWN);
242
}
243
244
-void show_reflog_message(struct reflog_walk_info* info, int oneline,
244
+void show_reflog_message(struct reflog_walk_info *info, int oneline,
245
enum date_mode dmode)
246
{
247
if (info && info->last_commit_reflog) {
run-command.c
+1
-1
@@ -106,7 +106,7 @@ int start_command(struct child_process *cmd)
106
if (cmd->env) {
107
for (; *cmd->env; cmd->env++) {
108
if (strchr(*cmd->env, '='))
109
- putenv((char*)*cmd->env);
109
+ putenv((char *)*cmd->env);
110
else
111
unsetenv(*cmd->env);
112
}
server-info.c
+2
-2
@@ -132,8 +132,8 @@ static int read_pack_info_file(const char *infofile)
132
133
static int compare_info(const void *a_, const void *b_)
134
{
135
- struct pack_info * const* a = a_;
136
- struct pack_info * const* b = b_;
135
+ struct pack_info *const *a = a_;
136
+ struct pack_info *const *b = b_;
137
138
if (0 <= (*a)->old_num && 0 <= (*b)->old_num)
139
/* Keep the order in the original */
sha1_file.c
+1
-1
@@ -791,7 +791,7 @@ static int in_window(struct pack_window *win, off_t offset)
791
&& (offset + 20) <= (win_off + win->len);
792
}
793
794
-unsigned char* use_pack(struct packed_git *p,
794
+unsigned char *use_pack(struct packed_git *p,
795
struct pack_window **w_cursor,
796
off_t offset,
797
unsigned int *left)
wt-status.c
+1
-1
@@ -40,7 +40,7 @@ static int parse_status_slot(const char *var, int offset)
40
die("bad config variable '%s'", var);
41
}
42
43
-static const char* color(int slot)
43
+static const char *color(int slot)
44
{
45
return wt_status_use_color > 0 ? wt_status_colors[slot] : "";
46
}