shrink git-shell by avoiding redundant dependencies

A lot of modules that have nothing to do with git-shell functionality
were linked in, bloating git-shell more than 8 times.

This patch cuts off redundant dependencies by:
1. providing stubs for three functions that make no sense for git-shell;
2. moving quote_path_fully from environment.c to quote.c to make the
   later self sufficient;
3. moving make_absolute_path into a new separate file.

The following numbers have been received with the default optimization
settings on master using GCC 4.1.2:

Before:
   text    data     bss     dec     hex filename
 143915    1348   93168  238431   3a35f git-shell

After:
   text    data     bss     dec     hex filename
  17670     788    8232   26690    6842 git-shell

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Dmitry Potapov
2008-06-28 00:46:42 +04:00
committed by Junio C Hamano
parent 2dce956e39
commit 5b8e6f85f9
6 changed files with 79 additions and 68 deletions

View File

@ -3,6 +3,14 @@
#include "exec_cmd.h"
#include "strbuf.h"
/* Stubs for functions that make no sense for git-shell. These stubs
* are provided here to avoid linking in external redundant modules.
*/
void release_pack_memory(size_t need, int fd){}
void trace_argv_printf(const char **argv, const char *fmt, ...){}
void trace_printf(const char *fmt, ...){}
static int do_generic_cmd(const char *me, char *arg)
{
const char *my_argv[4];