Skip to content

Commit

Permalink
Requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-peterson committed May 17, 2024
1 parent 92f845b commit 8f4886c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "wildmatch.h"
#include "ws.h"

#define parse_range apply_parse_fragment_range

struct gitdiff_data {
struct strbuf *root;
int linenr;
Expand Down Expand Up @@ -1438,7 +1440,7 @@ static int parse_num(const char *line, unsigned long *p)
return ptr - line;
}

int parse_range(const char *line, int len, int offset, const char *expect,
int apply_parse_fragment_range(const char *line, int len, int offset, const char *expect,
unsigned long *p1, unsigned long *p2)
{
int digits, ex;
Expand Down
10 changes: 7 additions & 3 deletions apply.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,12 @@ int apply_all_patches(struct apply_state *state,
int argc, const char **argv,
int options);

#define apply_parse_fragment_range parse_range
int parse_range(const char *line, int len, int offset, const char *expect,
unsigned long *p1, unsigned long *p2);
/*
* exposed only for tests; do not call this as it not
* a part of the API
*/
extern int apply_parse_fragment_range(const char *line, int len, int offset,
const char *expect, unsigned long *p1,
unsigned long *p2);

#endif
3 changes: 2 additions & 1 deletion t/unit-tests/t-apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ static void setup_static(struct test_case t)
{
unsigned long p1 = 9999;
unsigned long p2 = 9999;
int result = apply_parse_fragment_range(t.line, strlen(t.line), t.offset, t.expect_suffix, &p1, &p2);
int result = apply_parse_fragment_range(t.line, strlen(t.line), t.offset,
t.expect_suffix, &p1, &p2);
check_int(result, ==, t.expect_result);
check_int(p1, ==, t.expect_p1);
check_int(p2, ==, t.expect_p2);
Expand Down

0 comments on commit 8f4886c

Please sign in to comment.