summaryrefslogtreecommitdiffstats
path: root/Modules/regexpr.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-09-05 01:48:48 (GMT)
committerGuido van Rossum <guido@python.org>1997-09-05 01:48:48 (GMT)
commit8102c005e0deffa61ba30b6a58512925d5c6e416 (patch)
treef6b6b2efe16bbc61ad63ddafef69647f321e68ad /Modules/regexpr.c
parent6459627b125147a86a7c29bfefdb44d8f719653e (diff)
downloadcpython-8102c005e0deffa61ba30b6a58512925d5c6e416.zip
cpython-8102c005e0deffa61ba30b6a58512925d5c6e416.tar.gz
cpython-8102c005e0deffa61ba30b6a58512925d5c6e416.tar.bz2
Get rid of most silly #include and #ifdefs near the top; these are all
obsolete now it includes Python.h. Make all functions K&R compatible (Sue Williams).
Diffstat (limited to 'Modules/regexpr.c')
-rw-r--r--Modules/regexpr.c114
1 files changed, 59 insertions, 55 deletions
diff --git a/Modules/regexpr.c b/Modules/regexpr.c
index 4279d61..7cdcbd9 100644
--- a/Modules/regexpr.c
+++ b/Modules/regexpr.c
@@ -28,35 +28,9 @@
*
* $Id$ */
-#include "config.h" /* For Win* specific redefinition of printf c.s. */
-
-#include "myproto.h" /* For PROTO macro --Guido */
-
-#include <stdio.h>
#include "Python.h"
-
-#ifndef NDEBUG
-#define NDEBUG 1
-#endif
-
-#include <assert.h>
#include "regexpr.h"
-
-#ifdef THINK_C
-/* Think C on the Mac really needs these headers... --Guido */
-#include <stdlib.h>
-#include <string.h>
-#else
-#if defined(__STDC__) || defined(_MSC_VER)
-/* Don't mess around, use the standard headers */
-#include <stdlib.h>
-#include <string.h>
-#else
-char *malloc();
-void free();
-char *realloc();
-#endif /* __STDC__ */
-#endif /* THINK_C */
+#include <assert.h>
/* The original code blithely assumed that sizeof(short) == 2. Not
* always true. Original instances of "(short)x" were replaced by
@@ -472,7 +446,7 @@ static int regexp_ansi_sequences;
unsigned char re_syntax_table[256];
-void re_compile_initialize(void)
+void re_compile_initialize()
{
int a;
@@ -572,7 +546,8 @@ void re_compile_initialize(void)
regexp_ansi_sequences = (regexp_syntax & RE_ANSI_HEX) != 0;
}
-int re_set_syntax(int syntax)
+int re_set_syntax(syntax)
+ int syntax;
{
int ret;
@@ -583,7 +558,8 @@ int re_set_syntax(int syntax)
return ret;
}
-static int hex_char_to_decimal(int ch)
+static int hex_char_to_decimal(ch)
+ int ch;
{
if (ch >= '0' && ch <= '9')
return ch - '0';
@@ -594,11 +570,16 @@ static int hex_char_to_decimal(int ch)
return 16;
}
-static void re_compile_fastmap_aux(unsigned char *code,
- int pos,
- unsigned char *visited,
- unsigned char *can_be_null,
- unsigned char *fastmap)
+static void re_compile_fastmap_aux(code,
+ pos,
+ visited,
+ can_be_null,
+ fastmap)
+ unsigned char *code;
+ int pos;
+ unsigned char *visited;
+ unsigned char *can_be_null;
+ unsigned char *fastmap;
{
int a;
int b;
@@ -725,11 +706,16 @@ static void re_compile_fastmap_aux(unsigned char *code,
}
}
-static int re_do_compile_fastmap(unsigned char *buffer,
- int used,
- int pos,
- unsigned char *can_be_null,
- unsigned char *fastmap)
+static int re_do_compile_fastmap(buffer,
+ used,
+ pos,
+ can_be_null,
+ fastmap)
+ unsigned char *buffer;
+ int used;
+ int pos;
+ unsigned char *can_be_null;
+ unsigned char *fastmap;
{
unsigned char small_visited[512], *visited;
@@ -750,7 +736,8 @@ static int re_do_compile_fastmap(unsigned char *buffer,
return 1;
}
-void re_compile_fastmap(regexp_t bufp)
+void re_compile_fastmap(bufp)
+ regexp_t bufp;
{
if (!bufp->fastmap || bufp->fastmap_accurate)
return;
@@ -795,7 +782,9 @@ void re_compile_fastmap(regexp_t bufp)
*
*/
-static int re_optimize_star_jump(regexp_t bufp, unsigned char *code)
+static int re_optimize_star_jump(bufp, code)
+ regexp_t bufp;
+ unsigned char *code;
{
unsigned char map[256];
unsigned char can_be_null;
@@ -956,7 +945,8 @@ static int re_optimize_star_jump(regexp_t bufp, unsigned char *code)
return 1;
}
-static int re_optimize(regexp_t bufp)
+static int re_optimize(bufp)
+ regexp_t bufp;
{
unsigned char *code;
@@ -1157,7 +1147,10 @@ else \
} \
}
-char *re_compile_pattern(unsigned char *regex, int size, regexp_t bufp)
+char *re_compile_pattern(regex, size, bufp)
+ unsigned char *regex;
+ int size;
+ regexp_t bufp;
{
int a;
int pos;
@@ -1589,11 +1582,16 @@ var = (unsigned char)*text++; \
if (translate) \
var = translate[var]
-int re_match(regexp_t bufp,
- unsigned char *string,
- int size,
- int pos,
- regexp_registers_t old_regs)
+int re_match(bufp,
+ string,
+ size,
+ pos,
+ old_regs)
+ regexp_t bufp;
+ unsigned char *string;
+ int size;
+ int pos;
+ regexp_registers_t old_regs;
{
unsigned char *code;
unsigned char *translate;
@@ -2019,12 +2017,18 @@ int re_match(regexp_t bufp,
#undef PREFETCH
#undef NEXTCHAR
-int re_search(regexp_t bufp,
- unsigned char *string,
- int size,
- int pos,
- int range,
- regexp_registers_t regs)
+int re_search(bufp,
+ string,
+ size,
+ pos,
+ range,
+ regs)
+ regexp_t bufp;
+ unsigned char *string;
+ int size;
+ int pos;
+ int range;
+ regexp_registers_t regs;
{
unsigned char *fastmap;
unsigned char *translate;