mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Fix some sloppiness in new PL/python get_source_line() function.
Jan Urbański
This commit is contained in:
@ -4484,12 +4484,11 @@ cleanup:
|
|||||||
static char *
|
static char *
|
||||||
get_source_line(const char *src, int lineno)
|
get_source_line(const char *src, int lineno)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s = NULL;
|
||||||
const char *next;
|
const char *next = src;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
next = src;
|
while (current < lineno)
|
||||||
while (current != lineno)
|
|
||||||
{
|
{
|
||||||
s = next;
|
s = next;
|
||||||
next = strchr(s + 1, '\n');
|
next = strchr(s + 1, '\n');
|
||||||
@ -4501,7 +4500,7 @@ get_source_line(const char *src, int lineno)
|
|||||||
if (current != lineno)
|
if (current != lineno)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
while (s && isspace((unsigned char) *s))
|
while (*s && isspace((unsigned char) *s))
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
if (next == NULL)
|
if (next == NULL)
|
||||||
|
Reference in New Issue
Block a user