Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
3d9b6f31
Commit
3d9b6f31
authored
Feb 21, 2015
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code beautification in conninfo_uri_parse_params().
Reading this made me itch, so clean the logic a bit.
parent
b26e2081
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
36 deletions
+19
-36
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+19
-36
No files found.
src/interfaces/libpq/fe-connect.c
View file @
3d9b6f31
...
@@ -4934,36 +4934,30 @@ conninfo_uri_parse_params(char *params,
...
@@ -4934,36 +4934,30 @@ conninfo_uri_parse_params(char *params,
{
{
printfPQExpBuffer
(
errorMessage
,
printfPQExpBuffer
(
errorMessage
,
libpq_gettext
(
"extra key/value separator
\"
=
\"
in URI query parameter:
\"
%s
\"\n
"
),
libpq_gettext
(
"extra key/value separator
\"
=
\"
in URI query parameter:
\"
%s
\"\n
"
),
params
);
keyword
);
return
false
;
return
false
;
}
}
/* Cut off keyword, advance to value */
/* Cut off keyword, advance to value */
*
p
=
'\0'
;
*
p
++
=
'\0'
;
value
=
++
p
;
value
=
p
;
}
}
else
if
(
*
p
==
'&'
||
*
p
==
'\0'
)
else
if
(
*
p
==
'&'
||
*
p
==
'\0'
)
{
{
char
prevchar
;
/*
* If not at the end, cut off value and advance; leave p
/* Cut off value, remember old value */
* pointing to start of the next parameter, if any.
prevchar
=
*
p
;
*/
*
p
=
'\0'
;
if
(
*
p
!=
'\0'
)
*
p
++
=
'\0'
;
/* Was there '=' at all? */
/* Was there '=' at all? */
if
(
value
==
NULL
)
if
(
value
==
NULL
)
{
{
printfPQExpBuffer
(
errorMessage
,
printfPQExpBuffer
(
errorMessage
,
libpq_gettext
(
"missing key/value separator
\"
=
\"
in URI query parameter:
\"
%s
\"\n
"
),
libpq_gettext
(
"missing key/value separator
\"
=
\"
in URI query parameter:
\"
%s
\"\n
"
),
params
);
keyword
);
return
false
;
return
false
;
}
}
/* Got keyword and value, go process them. */
/*
* If not at the end, advance; now pointing to start of the
* next parameter, if any.
*/
if
(
prevchar
!=
'\0'
)
++
p
;
break
;
break
;
}
}
else
else
...
@@ -5007,24 +5001,12 @@ conninfo_uri_parse_params(char *params,
...
@@ -5007,24 +5001,12 @@ conninfo_uri_parse_params(char *params,
if
(
!
conninfo_storeval
(
connOptions
,
keyword
,
value
,
if
(
!
conninfo_storeval
(
connOptions
,
keyword
,
value
,
errorMessage
,
true
,
false
))
errorMessage
,
true
,
false
))
{
{
/*
/* Insert generic message if conninfo_storeval didn't give one. */
* Check if there was a hard error when decoding or storing the
if
(
errorMessage
->
len
==
0
)
* option.
printfPQExpBuffer
(
errorMessage
,
*/
libpq_gettext
(
"invalid URI query parameter:
\"
%s
\"\n
"
),
if
(
errorMessage
->
len
!=
0
)
keyword
);
{
/* And fail. */
if
(
malloced
)
{
free
(
keyword
);
free
(
value
);
}
return
false
;
}
printfPQExpBuffer
(
errorMessage
,
libpq_gettext
(
"invalid URI query parameter:
\"
%s
\"\n
"
),
keyword
);
if
(
malloced
)
if
(
malloced
)
{
{
free
(
keyword
);
free
(
keyword
);
...
@@ -5032,13 +5014,14 @@ conninfo_uri_parse_params(char *params,
...
@@ -5032,13 +5014,14 @@ conninfo_uri_parse_params(char *params,
}
}
return
false
;
return
false
;
}
}
if
(
malloced
)
if
(
malloced
)
{
{
free
(
keyword
);
free
(
keyword
);
free
(
value
);
free
(
value
);
}
}
/* Proceed to next key=value pair */
/* Proceed to next key=value pair
, if any
*/
params
=
p
;
params
=
p
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment