On Sun, 8 Sep 2013, Nguyễn Thái Ngọc Duy wrote:
> git-packv4-create now becomes test-packv4. Code that will not be used
> by pack-objects.c is moved to test-packv4.c. It may be removed when
> the code transition to pack-objects completes.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
> ---
> Makefile | 4 +-
> packv4-create.c | 491
> +---------------------------------------------------
> packv4-create.h | 39 +++++
> test-packv4.c (new) | 476 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 525 insertions(+), 485 deletions(-)
> create mode 100644 test-packv4.c
>
> diff --git a/Makefile b/Makefile
> index 22fc276..af2e3e3 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -550,7 +550,6 @@ PROGRAM_OBJS += shell.o
> PROGRAM_OBJS += show-index.o
> PROGRAM_OBJS += upload-pack.o
> PROGRAM_OBJS += remote-testsvn.o
> -PROGRAM_OBJS += packv4-create.o
>
> # Binary suffix, set to .exe for Windows builds
> X =
> @@ -568,6 +567,7 @@ TEST_PROGRAMS_NEED_X += test-line-buffer
> TEST_PROGRAMS_NEED_X += test-match-trees
> TEST_PROGRAMS_NEED_X += test-mergesort
> TEST_PROGRAMS_NEED_X += test-mktemp
> +TEST_PROGRAMS_NEED_X += test-packv4
> TEST_PROGRAMS_NEED_X += test-parse-options
> TEST_PROGRAMS_NEED_X += test-path-utils
> TEST_PROGRAMS_NEED_X += test-prio-queue
> @@ -702,6 +702,7 @@ LIB_H += notes.h
> LIB_H += object.h
> LIB_H += pack-revindex.h
> LIB_H += pack.h
> +LIB_H += packv4-create.h
> LIB_H += packv4-parse.h
> LIB_H += parse-options.h
> LIB_H += patch-ids.h
> @@ -839,6 +840,7 @@ LIB_OBJS += object.o
> LIB_OBJS += pack-check.o
> LIB_OBJS += pack-revindex.o
> LIB_OBJS += pack-write.o
> +LIB_OBJS += packv4-create.o
> LIB_OBJS += packv4-parse.o
> LIB_OBJS += pager.o
> LIB_OBJS += parse-options.o
> diff --git a/packv4-create.c b/packv4-create.c
> index 920a0b4..cdf82c0 100644
> --- a/packv4-create.c
> +++ b/packv4-create.c
> @@ -18,9 +18,9 @@
> #include "packv4-create.h"
>
>
> -static int pack_compression_seen;
> -static int pack_compression_level = Z_DEFAULT_COMPRESSION;
> -static int min_tree_copy = 1;
> +int pack_compression_seen;
> +int pack_compression_level = Z_DEFAULT_COMPRESSION;
> +int min_tree_copy = 1;
>
> struct data_entry {
> unsigned offset;
> @@ -28,17 +28,6 @@ struct data_entry {
> unsigned hits;
> };
>
> -struct dict_table {
> - unsigned char *data;
> - unsigned cur_offset;
> - unsigned size;
> - struct data_entry *entry;
> - unsigned nb_entries;
> - unsigned max_entries;
> - unsigned *hash;
> - unsigned hash_size;
> -};
It doesn't seem necessary to move this structure definition to the
header file. Only an opaque
struct dict_table;
should be needed in packv4-create.h. That would keep the dictionary
handling localized.
Nicolas