Skip to content

Commit 134e40d

Browse files
peffgitster
authored andcommitted
xdiff: rename "struct group" to "struct xdlgroup"
Commit e8adf23 (xdl_change_compact(): introduce the concept of a change group, 2016-08-22) added a "struct group" type to xdiff/xdiffi.c. But the POSIX system header "grp.h" already defines "struct group" (it is part of the getgrnam interface). This happens to work because the new type is local to xdiffi.c, and the xdiff code includes a relatively small set of system headers. But it will break compilation if xdiff ever switches to using git-compat-util.h. It can also probably cause confusion with tools that look at the whole code base, like coccinelle or ctags. Let's resolve by giving the xdiff variant a scoped name, which is closer to other xdiff types anyway (e.g., xdlfile_t, though note that xdiff is fond if typedefs when Git usually is not). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b16287 commit 134e40d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

xdiff/xdiffi.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ static int score_cmp(struct split_score *s1, struct split_score *s2)
708708
* Note that loops that are testing for changed lines in xdf->rchg do not need
709709
* index bounding since the array is prepared with a zero at position -1 and N.
710710
*/
711-
struct group {
711+
struct xdlgroup {
712712
/*
713713
* The index of the first changed line in the group, or the index of
714714
* the unchanged line above which the (empty) group is located.
@@ -725,7 +725,7 @@ struct group {
725725
/*
726726
* Initialize g to point at the first group in xdf.
727727
*/
728-
static void group_init(xdfile_t *xdf, struct group *g)
728+
static void group_init(xdfile_t *xdf, struct xdlgroup *g)
729729
{
730730
g->start = g->end = 0;
731731
while (xdf->rchg[g->end])
@@ -736,7 +736,7 @@ static void group_init(xdfile_t *xdf, struct group *g)
736736
* Move g to describe the next (possibly empty) group in xdf and return 0. If g
737737
* is already at the end of the file, do nothing and return -1.
738738
*/
739-
static inline int group_next(xdfile_t *xdf, struct group *g)
739+
static inline int group_next(xdfile_t *xdf, struct xdlgroup *g)
740740
{
741741
if (g->end == xdf->nrec)
742742
return -1;
@@ -752,7 +752,7 @@ static inline int group_next(xdfile_t *xdf, struct group *g)
752752
* Move g to describe the previous (possibly empty) group in xdf and return 0.
753753
* If g is already at the beginning of the file, do nothing and return -1.
754754
*/
755-
static inline int group_previous(xdfile_t *xdf, struct group *g)
755+
static inline int group_previous(xdfile_t *xdf, struct xdlgroup *g)
756756
{
757757
if (g->start == 0)
758758
return -1;
@@ -769,7 +769,7 @@ static inline int group_previous(xdfile_t *xdf, struct group *g)
769769
* following group, expand this group to include it. Return 0 on success or -1
770770
* if g cannot be slid down.
771771
*/
772-
static int group_slide_down(xdfile_t *xdf, struct group *g, long flags)
772+
static int group_slide_down(xdfile_t *xdf, struct xdlgroup *g, long flags)
773773
{
774774
if (g->end < xdf->nrec &&
775775
recs_match(xdf->recs[g->start], xdf->recs[g->end], flags)) {
@@ -790,7 +790,7 @@ static int group_slide_down(xdfile_t *xdf, struct group *g, long flags)
790790
* into a previous group, expand this group to include it. Return 0 on success
791791
* or -1 if g cannot be slid up.
792792
*/
793-
static int group_slide_up(xdfile_t *xdf, struct group *g, long flags)
793+
static int group_slide_up(xdfile_t *xdf, struct xdlgroup *g, long flags)
794794
{
795795
if (g->start > 0 &&
796796
recs_match(xdf->recs[g->start - 1], xdf->recs[g->end - 1], flags)) {
@@ -818,7 +818,7 @@ static void xdl_bug(const char *msg)
818818
* size.
819819
*/
820820
int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
821-
struct group g, go;
821+
struct xdlgroup g, go;
822822
long earliest_end, end_matching_other;
823823
long groupsize;
824824
unsigned int blank_lines;

0 commit comments

Comments
 (0)