Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Casey <casey@nrlssc.navy.mil>2008-10-09 23:12:12 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-10-12 23:36:19 +0400
commitf285a2d7ed6548666989406de8f0e7233eb84368 (patch)
tree2e422bd9ceeeb432ca03b61f91165790f0e37146 /builtin-remote.c
parent7e7abea96b8140c592a46293f5e33aae0683c7ac (diff)
Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializer
Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-remote.c')
-rw-r--r--builtin-remote.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/builtin-remote.c b/builtin-remote.c
index 90a4e35828..6b3325dfa9 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -54,7 +54,7 @@ static int add(int argc, const char **argv)
struct string_list track = { NULL, 0, 0 };
const char *master = NULL;
struct remote *remote;
- struct strbuf buf, buf2;
+ struct strbuf buf = STRBUF_INIT, buf2 = STRBUF_INIT;
const char *name, *url;
int i;
@@ -81,9 +81,6 @@ static int add(int argc, const char **argv)
remote->fetch_refspec_nr))
die("remote %s already exists.", name);
- strbuf_init(&buf, 0);
- strbuf_init(&buf2, 0);
-
strbuf_addf(&buf2, "refs/heads/test:refs/remotes/%s/test", name);
if (!valid_fetch_refspec(buf2.buf))
die("'%s' is not a valid remote name", name);
@@ -352,7 +349,7 @@ static int rm(int argc, const char **argv)
OPT_END()
};
struct remote *remote;
- struct strbuf buf;
+ struct strbuf buf = STRBUF_INIT;
struct known_remotes known_remotes = { NULL, NULL };
struct string_list branches = { NULL, 0, 0, 1 };
struct branches_for_remote cb_data = { NULL, &branches, &known_remotes };
@@ -368,7 +365,6 @@ static int rm(int argc, const char **argv)
known_remotes.to_delete = remote;
for_each_remote(add_known_remote, &known_remotes);
- strbuf_init(&buf, 0);
strbuf_addf(&buf, "remote.%s", remote->name);
if (git_config_rename_section(buf.buf, NULL) < 1)
return error("Could not remove config section '%s'", buf.buf);