Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7bef9e

Browse files
author
Nikita Glukhov
committed
Extract lex_peek_value()
1 parent14daf4a commita7bef9e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎src/common/jsonapi.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ lex_peek(JsonLexContext *lex)
7272
returnlex->token_type;
7373
}
7474

75+
staticinlinechar*
76+
lex_peek_value(JsonLexContext*lex)
77+
{
78+
if (lex->token_type==JSON_TOKEN_STRING)
79+
returnlex->strval ?pstrdup(lex->strval->data) :NULL;
80+
else
81+
{
82+
intlen= (lex->token_terminator-lex->token_start);
83+
char*tokstr=palloc(len+1);
84+
85+
memcpy(tokstr,lex->token_start,len);
86+
tokstr[len]='\0';
87+
returntokstr;
88+
}
89+
}
90+
7591
/*
7692
* lex_expect
7793
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp