Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
trailer: improve const correctness
author
Jonathan Tan
<jonathantanmy@google.com>
Fri, 14 Oct 2016 17:37:58 +0000
(10:37 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 14 Oct 2016 19:07:57 +0000
(12:07 -0700)
Change "const char *" to "char *" in struct trailer_item and in the
return value of apply_command (since those strings are owned strings).
Change "struct conf_info *" to "const struct conf_info *" (since that
struct is not modified).
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
trailer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
3cdd5d1
)
diff --git
a/trailer.c
b/trailer.c
index c6ea9ac64d75292021919ad54462a3e4b782b080..1f191b20b28637fe7487ec9755944ef29c9d5d47 100644
(file)
--- a/
trailer.c
+++ b/
trailer.c
@@
-27,8
+27,8
@@
static struct conf_info default_conf_info;
struct trailer_item {
struct trailer_item *previous;
struct trailer_item *next;
struct trailer_item {
struct trailer_item *previous;
struct trailer_item *next;
- c
onst c
har *token;
- c
onst c
har *value;
+ char *token;
+ char *value;
struct conf_info conf;
};
struct conf_info conf;
};
@@
-95,8
+95,8
@@
static void free_trailer_item(struct trailer_item *item)
free(item->conf.name);
free(item->conf.key);
free(item->conf.command);
free(item->conf.name);
free(item->conf.key);
free(item->conf.command);
- free(
(char *)
item->token);
- free(
(char *)
item->value);
+ free(item->token);
+ free(item->value);
free(item);
}
free(item);
}
@@
-215,13
+215,13
@@
static struct trailer_item *remove_first(struct trailer_item **first)
return item;
}
return item;
}
-static c
onst c
har *apply_command(const char *command, const char *arg)
+static char *apply_command(const char *command, const char *arg)
{
struct strbuf cmd = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
struct child_process cp = CHILD_PROCESS_INIT;
const char *argv[] = {NULL, NULL};
{
struct strbuf cmd = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;
struct child_process cp = CHILD_PROCESS_INIT;
const char *argv[] = {NULL, NULL};
- c
onst c
har *result;
+ char *result;
strbuf_addstr(&cmd, command);
if (arg)
strbuf_addstr(&cmd, command);
if (arg)
@@
-425,7
+425,7
@@
static int set_if_missing(struct conf_info *item, const char *value)
return 0;
}
return 0;
}
-static void duplicate_conf(struct conf_info *dst, struct conf_info *src)
+static void duplicate_conf(struct conf_info *dst,
const
struct conf_info *src)
{
*dst = *src;
if (src->name)
{
*dst = *src;
if (src->name)