Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57ba4f3

Browse files
committed
Patches by Fred Lundh to make it compile better with K&R compilers.
(Should really let AMK do this, but don't know when he'll give me a new version.)
1 parent e59d3f8 commit 57ba4f3

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

Modules/pypcre.c

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,7 @@ for (;; ptr++)
17351735
if (*errorptr) {
17361736
goto FAILED;
17371737
}
1738-
string = PyString_FromStringAndSize(ptr, idlen);
1738+
string = PyString_FromStringAndSize((char*)ptr, idlen);
17391739
intobj = PyInt_FromLong( brackets[0] );
17401740
if (intobj == NULL || string==NULL)
17411741
{
@@ -1760,7 +1760,7 @@ for (;; ptr++)
17601760
if (*errorptr) {
17611761
goto FAILED;
17621762
}
1763-
string = PyString_FromStringAndSize(ptr, idlen);
1763+
string = PyString_FromStringAndSize((char*)ptr, idlen);
17641764
if (string==NULL) {
17651765
Py_XDECREF(string);
17661766
*errorptr = "exception raised";
@@ -3004,19 +3004,19 @@ for (;;)
30043004
int number = (*ecode - OP_BRA) << 1;
30053005
int save_offset1 = 0, save_offset2 = 0;
30063006

3007-
#ifdef DEBUG
3007+
#ifdef DEBUG
30083008
printf("start bracket %d\n", number/2);
3009-
#endif
3009+
#endif
30103010

30113011
if (number > 0 && number < md->offset_end)
30123012
{
30133013
save_offset1 = md->offset_vector[number];
30143014
save_offset2 = md->offset_vector[number+1];
30153015
md->offset_vector[number] = eptr - md->start_subject;
30163016

3017-
#ifdef DEBUG
3017+
#ifdef DEBUG
30183018
printf("saving %d %d\n", save_offset1, save_offset2);
3019-
#endif
3019+
#endif
30203020
}
30213021

30223022
/* Recurse for all the alternatives. */
@@ -3028,9 +3028,9 @@ for (;;)
30283028
}
30293029
while (*ecode == OP_ALT);
30303030

3031-
#ifdef DEBUG
3031+
#ifdef DEBUG
30323032
printf("bracket %d failed\n", number/2);
3033-
#endif
3033+
#endif
30343034

30353035
if (number > 0 && number < md->offset_end)
30363036
{
@@ -3137,9 +3137,9 @@ for (;;)
31373137

31383138
number = (*prev - OP_BRA) << 1;
31393139

3140-
#ifdef DEBUG
3140+
#ifdef DEBUG
31413141
printf("end bracket %d\n", number/2);
3142-
#endif
3142+
#endif
31433143

31443144
if (number > 0)
31453145
{
@@ -3522,7 +3522,7 @@ for (;;)
35223522
register int length = ecode[1];
35233523
ecode += 2;
35243524

3525-
#ifdef DEBUG
3525+
#ifdef DEBUG
35263526
if (eptr >= md->end_subject)
35273527
printf("matching subject <null> against pattern ");
35283528
else
@@ -3533,7 +3533,7 @@ for (;;)
35333533
}
35343534
pchars(ecode, length, FALSE, md);
35353535
printf("\n");
3536-
#endif
3536+
#endif
35373537

35383538
if (length > md->end_subject - eptr) FAIL;
35393539
if (md->caseless)
@@ -3590,10 +3590,10 @@ for (;;)
35903590
maximum. Alternatively, if maximizing, find the maximum number of
35913591
characters and work backwards. */
35923592

3593-
#ifdef DEBUG
3593+
#ifdef DEBUG
35943594
printf("matching %c{%d,%d} against subject %.*s\n", c, min, max,
35953595
max, eptr);
3596-
#endif
3596+
#endif
35973597

35983598
if (md->caseless)
35993599
{
@@ -3842,9 +3842,9 @@ for (;;)
38423842
/* There's been some horrible disaster. */
38433843

38443844
default:
3845-
#ifdef DEBUG
3845+
#ifdef DEBUG
38463846
printf("Unknown opcode %d\n", *ecode);
3847-
#endif
3847+
#endif
38483848
md->errorcode = PCRE_ERROR_UNKNOWN_NODE;
38493849
FAIL;
38503850
}
@@ -4038,11 +4038,11 @@ do
40384038
}
40394039
}
40404040

4041-
#ifdef DEBUG
4041+
#ifdef DEBUG
40424042
printf(">>>> Match against: ");
40434043
pchars(start_match, end_subject - start_match, TRUE, &match_block);
40444044
printf("\n");
4045-
#endif
4045+
#endif
40464046

40474047
/* When a match occurs, substrings will be set for all internal extractions;
40484048
we just need to set up the whole thing as substring 0 before returning. If
@@ -4056,9 +4056,9 @@ do
40564056
offsets[0] = start_match - match_block.start_subject;
40574057
offsets[1] = match_block.end_match_ptr - match_block.start_subject;
40584058
}
4059-
#ifdef DEBUG
4059+
#ifdef DEBUG
40604060
printf(">>>> returning %d\n", rc);
4061-
#endif
4061+
#endif
40624062
free_stack(&match_block);
40634063
return rc;
40644064
}

0 commit comments

Comments
 (0)