Re: [PATCH 2/2] Unify usage strings declaration

2005-07-29 Thread Matthias Urlichs
Hi, Junio C Hamano wrote:

> I do not have preference either way, and I've already merged
> them, but why char[] not char*?

A char* is a variable which points to the char[].
That's four (or eight) bytes we don't need. ;-)

C conflates the two concepts somewhat, which is one of the reasons
optimizing compiled C is somewhat more challenging than, say, FORTRAN.

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Giving every man a vote has no more made men wise
and free than Christianity has made them good.
-- H.L. Mencken


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] Unify usage strings declaration

2005-07-29 Thread Junio C Hamano
Petr Baudis <[EMAIL PROTECTED]> writes:

> All usage strings are now declared as static const char [].

I do not have preference either way, and I've already merged
them, but why char[] not char*?



-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Unify usage strings declaration

2005-07-29 Thread Petr Baudis
All usage strings are now declared as static const char [].

This is carried over from my old git-pb branch.

Signed-off-by: Petr Baudis <[EMAIL PROTECTED]>

---
commit 1e02de8f49a8fca696b3cb363545fad3c98fd662
tree feee1ccdea90d33fae2bf41621a876c5aa2ecfe5
parent 83b1762040b111b4736d108cd91b8a9d75aad3a9
author Petr Baudis <[EMAIL PROTECTED]> Sat, 23 Jul 2005 00:30:06 +0200
committer Petr Baudis <[EMAIL PROTECTED]> Sat, 23 Jul 2005 00:30:06 +0200

 checkout-cache.c |2 +-
 commit-tree.c|2 +-
 diff-cache.c |2 +-
 diff-files.c |2 +-
 diff-helper.c|2 +-
 diff-stages.c|2 +-
 diff-tree.c  |2 +-
 hash-object.c|2 +-
 local-pull.c |2 +-
 ls-files.c   |2 +-
 ls-tree.c|2 +-
 read-tree.c  |2 +-
 ssh-push.c   |2 +-
 tar-tree.c   |2 +-
 test-delta.c |2 +-
 var.c|2 +-
 verify-pack.c|2 +-
 17 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/checkout-cache.c b/checkout-cache.c
--- a/checkout-cache.c
+++ b/checkout-cache.c
@@ -75,7 +75,7 @@ static int checkout_all(void)
return 0;
 }
 
-static const char *checkout_cache_usage =
+static const char checkout_cache_usage[] =
 "git-checkout-cache [-u] [-q] [-a] [-f] [-n] [--prefix=] [--] 
...";
 
 int main(int argc, char **argv)
diff --git a/commit-tree.c b/commit-tree.c
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -64,7 +64,7 @@ static void check_valid(unsigned char *s
 #define MAXPARENT (16)
 static unsigned char parent_sha1[MAXPARENT][20];
 
-static char *commit_tree_usage = "git-commit-tree  [-p ]* < 
changelog";
+static const char commit_tree_usage[] = "git-commit-tree  [-p ]* < 
changelog";
 
 static int new_parent(int idx)
 {
diff --git a/diff-cache.c b/diff-cache.c
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -163,7 +163,7 @@ static void mark_merge_entries(void)
}
 }
 
-static char *diff_cache_usage =
+static const char diff_cache_usage[] =
 "git-diff-cache [-m] [--cached] "
 "[]  [...]"
 COMMON_DIFF_OPTIONS_HELP;
diff --git a/diff-files.c b/diff-files.c
--- a/diff-files.c
+++ b/diff-files.c
@@ -6,7 +6,7 @@
 #include "cache.h"
 #include "diff.h"
 
-static const char *diff_files_usage =
+static const char diff_files_usage[] =
 "git-diff-files [-q] "
 "[] [...]"
 COMMON_DIFF_OPTIONS_HELP;
diff --git a/diff-helper.c b/diff-helper.c
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -20,7 +20,7 @@ static void flush_them(int ac, const cha
diff_flush(DIFF_FORMAT_PATCH, '\n');
 }
 
-static const char *diff_helper_usage =
+static const char diff_helper_usage[] =
 "git-diff-helper [-z] [-O] [-S] [--pickaxe-all] 
[...]";
 
 int main(int ac, const char **av) {
diff --git a/diff-stages.c b/diff-stages.c
--- a/diff-stages.c
+++ b/diff-stages.c
@@ -17,7 +17,7 @@ static int diff_break_opt = -1;
 static const char *orderfile = NULL;
 static const char *diff_filter = NULL;
 
-static char *diff_stages_usage =
+static const char diff_stages_usage[] =
 "git-diff-stages []   [...]"
 COMMON_DIFF_OPTIONS_HELP;
 
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -395,7 +395,7 @@ static int diff_tree_stdin(char *line)
return diff_tree_commit(commit, line);
 }
 
-static char *diff_tree_usage =
+static const char diff_tree_usage[] =
 "git-diff-tree [--stdin] [-m] [-s] [-v] [--pretty] [-t] "
 "[]  "
 COMMON_DIFF_OPTIONS_HELP;
diff --git a/hash-object.c b/hash-object.c
--- a/hash-object.c
+++ b/hash-object.c
@@ -21,7 +21,7 @@ static void hash_object(const char *path
printf("%s\n", sha1_to_hex(sha1));
 }
 
-static const char *hash_object_usage =
+static const char hash_object_usage[] =
 "git-hash-object [-t ] [-w] ...";
 
 int main(int argc, char **argv)
diff --git a/local-pull.c b/local-pull.c
--- a/local-pull.c
+++ b/local-pull.c
@@ -101,7 +101,7 @@ int fetch_ref(char *ref, unsigned char *
return 0;
 }
 
-static const char *local_pull_usage = 
+static const char local_pull_usage[] =
 "git-local-pull [-c] [-t] [-a] [-d] [-v] [-w filename] [--recover] [-l] [-s] 
[-n] commit-id path";
 
 /* 
diff --git a/ls-files.c b/ls-files.c
--- a/ls-files.c
+++ b/ls-files.c
@@ -285,7 +285,7 @@ static void show_files(void)
}
 }
 
-static const char *ls_files_usage =
+static const char ls_files_usage[] =
"git-ls-files [-z] [-t] 
(--[cached|deleted|others|stage|unmerged|killed])* "
"[ --ignored [--exclude=] [--exclude-from=) ]";
 
diff --git a/ls-tree.c b/ls-tree.c
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -208,7 +208,7 @@ static int list(char **path)
return err;
 }
 
-static const char *ls_tree_usage =
+static const char ls_tree_usage[] =
"git-ls-tree [-d] [-r] [-z]  [path...]";
 
 int main(int argc, char **argv)
diff --git a/read-tree.c b/read-tree.c
--- a/read-tree.c
+++ b/read-tree.c
@@ -510,7 +510,7 @@ static int read_cache_unmerged(void)
return deleted;
 }
 
-static char *read_tree_usage = "git-read-tree ( | -m [-u]  [ 
[]])";
+static const char read_tree_us