Skip to content

Commit

Permalink
Merge branch 'dd/sparse-fixes'
Browse files Browse the repository at this point in the history
Compilation fix.

* dd/sparse-fixes:
  progress.c: silence cgcc suggestion about internal linkage
  graph.c: limit linkage of internal variable
  compat/regex: move stdlib.h up in inclusion chain
  test-parse-pathspec-file.c: s/0/NULL/ for pointer type
  • Loading branch information
gitster committed May 1, 2020
2 parents 3e68f55 + 3cacb9a commit bf04590
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
1 change: 1 addition & 0 deletions compat/regex/regex.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#undefs RE_DUP_MAX and sets it to the right value. */
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>

#ifdef GAWK
#undef alloca
Expand Down
1 change: 0 additions & 1 deletion compat/regex/regex_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
Expand Down
2 changes: 1 addition & 1 deletion fmt-merge-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ static void fmt_merge_msg_sigs(struct strbuf *out)
enum object_type type;
unsigned long size, len;
char *buf = read_object_file(oid, &type, &size);
struct signature_check sigc = { 0 };
struct signature_check sigc = { NULL };
struct strbuf sig = STRBUF_INIT;

if (!buf || type != OBJ_TAG)
Expand Down
2 changes: 1 addition & 1 deletion graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ static void graph_output_commit_line(struct git_graph *graph, struct graph_line
graph_update_state(graph, GRAPH_COLLAPSING);
}

const char merge_chars[] = {'/', '|', '\\'};
static const char merge_chars[] = {'/', '|', '\\'};

static void graph_output_post_merge_line(struct git_graph *graph, struct graph_line *line)
{
Expand Down
2 changes: 1 addition & 1 deletion progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* published by the Free Software Foundation.
*/

#define GIT_TEST_PROGRESS_ONLY
#include "cache.h"
#include "gettext.h"
#include "progress.h"
Expand Down Expand Up @@ -52,7 +53,6 @@ static volatile sig_atomic_t progress_update;
*/
int progress_testing;
uint64_t progress_test_ns = 0;
void progress_test_force_update(void); /* To silence -Wmissing-prototypes */
void progress_test_force_update(void)
{
progress_update = 1;
Expand Down
8 changes: 8 additions & 0 deletions progress.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

struct progress;

#ifdef GIT_TEST_PROGRESS_ONLY

extern int progress_testing;
extern uint64_t progress_test_ns;
void progress_test_force_update(void);

#endif

void display_throughput(struct progress *progress, uint64_t total);
void display_progress(struct progress *progress, uint64_t n);
struct progress *start_progress(const char *title, uint64_t total);
Expand Down
6 changes: 3 additions & 3 deletions t/helper/test-parse-pathspec-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
int cmd__parse_pathspec_file(int argc, const char **argv)
{
struct pathspec pathspec;
const char *pathspec_from_file = 0;
const char *pathspec_from_file = NULL;
int pathspec_file_nul = 0, i;

static const char *const usage[] = {
Expand All @@ -20,9 +20,9 @@ int cmd__parse_pathspec_file(int argc, const char **argv)
OPT_END()
};

parse_options(argc, argv, 0, options, usage, 0);
parse_options(argc, argv, NULL, options, usage, 0);

parse_pathspec_file(&pathspec, 0, 0, 0, pathspec_from_file,
parse_pathspec_file(&pathspec, 0, 0, NULL, pathspec_from_file,
pathspec_file_nul);

for (i = 0; i < pathspec.nr; i++)
Expand Down
9 changes: 1 addition & 8 deletions t/helper/test-progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,13 @@
*
* See 't0500-progress-display.sh' for examples.
*/
#define GIT_TEST_PROGRESS_ONLY
#include "test-tool.h"
#include "gettext.h"
#include "parse-options.h"
#include "progress.h"
#include "strbuf.h"

/*
* These are defined in 'progress.c', but are not exposed in 'progress.h',
* because they are exclusively for testing.
*/
extern int progress_testing;
extern uint64_t progress_test_ns;
void progress_test_force_update(void);

int cmd__progress(int argc, const char **argv)
{
int total = 0;
Expand Down

0 comments on commit bf04590

Please sign in to comment.