Skip to content

Commit

Permalink
regexp.c: Remove another compat definition of strcspn()
Browse files Browse the repository at this point in the history
  • Loading branch information
krytarowski committed Jun 7, 2020
1 parent db13152 commit d3d7144
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions regexp.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* *** NOTE: this code has been altered slightly for use in Tcl. ***
* *** The only change is to use ckalloc and ckfree instead of ***
* *** malloc and free. ***
*
* 2019-11-07 Remove another compat definition of strcspn()
*/
#include "tclInt.h"

Expand Down Expand Up @@ -172,9 +174,6 @@ static void regc();
static void reginsert();
static void regtail();
static void regoptail();
#ifdef STRCSPN
static int strcspn();
#endif

/*
- regcomp - compile a regular expression into internal code
Expand Down Expand Up @@ -1189,35 +1188,3 @@ char *op;
return(buf);
}
#endif

/*
* The following is provided for those people who do not have strcspn() in
* their C libraries. They should get off their butts and do something
* about it; at least one public-domain implementation of those (highly
* useful) string routines has been published on Usenet.
*/
#ifdef STRCSPN
/*
* strcspn - find length of initial segment of s1 consisting entirely
* of characters not from s2
*/

static int
strcspn(s1, s2)
char *s1;
char *s2;
{
char *scan1;
char *scan2;
int count;

count = 0;
for (scan1 = s1; *scan1 != '\0'; scan1++) {
for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */
if (*scan1 == *scan2++)
return(count);
count++;
}
return(count);
}
#endif

0 comments on commit d3d7144

Please sign in to comment.