Skip to content

Commit

Permalink
Simplify crud() in ident.c
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Dec 4, 2007
1 parent 5188408 commit f64c81d
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,15 @@ static int add_raw(char *buf, size_t size, int offset, const char *str)

static int crud(unsigned char c)
{
static char crud_array[256];
static int crud_array_initialized = 0;

if (!crud_array_initialized) {
int k;

for (k = 0; k <= 31; ++k) crud_array[k] = 1;
crud_array[' '] = 1;
crud_array['.'] = 1;
crud_array[','] = 1;
crud_array[':'] = 1;
crud_array[';'] = 1;
crud_array['<'] = 1;
crud_array['>'] = 1;
crud_array['"'] = 1;
crud_array['\''] = 1;
crud_array_initialized = 1;
}
return crud_array[c];
return c <= 32 ||
c == '.' ||
c == ',' ||
c == ':' ||
c == ';' ||
c == '<' ||
c == '>' ||
c == '"' ||
c == '\'';
}

/*
Expand Down

0 comments on commit f64c81d

Please sign in to comment.