Merge git://repo.or.cz/git-gui into maint
[gitweb.git] / help.c
diff --git a/help.c b/help.c
index 6484cb9df2651de7430ee608ef7d14a4d3ac4c99..b6674635a2e08197cc13aaa6acbe6290a303d6b3 100644 (file)
--- a/help.c
+++ b/help.c
@@ -3,18 +3,17 @@
  *
  * Builtin help-related commands (help, usage, version)
  */
-#include <sys/ioctl.h>
 #include "cache.h"
 #include "builtin.h"
 #include "exec_cmd.h"
 #include "common-cmds.h"
-
+#include <sys/ioctl.h>
 
 /* most GUI terminals set COLUMNS (although some don't export it) */
 static int term_columns(void)
 {
        char *col_string = getenv("COLUMNS");
-       int n_cols = 0;
+       int n_cols;
 
        if (col_string && (n_cols = atoi(col_string)) > 0)
                return n_cols;
@@ -169,8 +168,8 @@ static void list_common_cmds_help(void)
 
        puts("The most commonly used git commands are:");
        for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
-               printf("    %s", common_cmds[i].name);
-               mput_char(' ', longest - strlen(common_cmds[i].name) + 4);
+               printf("   %s   ", common_cmds[i].name);
+               mput_char(' ', longest - strlen(common_cmds[i].name));
                puts(common_cmds[i].help);
        }
        puts("(use 'git help -a' to get a list of all installed git commands)");
@@ -184,7 +183,7 @@ static void show_man_page(const char *git_cmd)
                page = git_cmd;
        else {
                int page_len = strlen(git_cmd) + 4;
-               char *p = malloc(page_len + 1);
+               char *p = xmalloc(page_len + 1);
                strcpy(p, "git-");
                strcpy(p + 4, git_cmd);
                p[page_len] = 0;