Skip to content

Commit b6bc481

Browse files
committed
Fix some sloppiness in new PL/python get_source_line() function.
Jan Urbański
1 parent a531123 commit b6bc481

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/pl/plpython/plpython.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,12 +4484,11 @@ PLy_get_spi_error_data(PyObject *exc, char **detail, char **hint, char **query,
44844484
static char *
44854485
get_source_line(const char *src, int lineno)
44864486
{
4487-
const char *s;
4488-
const char *next;
4489-
int current = 0;
4487+
const char *s = NULL;
4488+
const char *next = src;
4489+
int current = 0;
44904490

4491-
next = src;
4492-
while (current != lineno)
4491+
while (current < lineno)
44934492
{
44944493
s = next;
44954494
next = strchr(s + 1, '\n');
@@ -4501,7 +4500,7 @@ get_source_line(const char *src, int lineno)
45014500
if (current != lineno)
45024501
return NULL;
45034502

4504-
while (s && isspace((unsigned char) *s))
4503+
while (*s && isspace((unsigned char) *s))
45054504
s++;
45064505

45074506
if (next == NULL)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy