Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
belle-sip
Commits
44bd1668
Commit
44bd1668
authored
Aug 04, 2013
by
Simon Morlat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add unquote routine to public API
parent
92336dbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
include/belle-sip/utils.h
include/belle-sip/utils.h
+6
-1
src/belle_sip_utils.c
src/belle_sip_utils.c
+20
-0
No files found.
include/belle-sip/utils.h
View file @
44bd1668
...
...
@@ -145,7 +145,7 @@ BELLESIP_EXPORT void belle_sip_set_log_handler(belle_sip_log_function_t func);
BELLESIP_EXPORT
char
*
BELLE_SIP_CHECK_FORMAT_ARGS
(
1
,
2
)
belle_sip_strdup_printf
(
const
char
*
fmt
,...);
BELLESIP_EXPORT
belle_sip_error_code
belle_sip_snprintf
(
char
*
buff
,
size_t
buff_size
,
size_t
*
offset
,
const
char
*
fmt
,
...);
BELLESIP_EXPORT
belle_sip_error_code
BELLE_SIP_CHECK_FORMAT_ARGS
(
4
,
5
)
belle_sip_snprintf
(
char
*
buff
,
size_t
buff_size
,
size_t
*
offset
,
const
char
*
fmt
,
...);
BELLESIP_EXPORT
void
belle_sip_set_log_level
(
int
level
);
...
...
@@ -159,6 +159,11 @@ BELLESIP_EXPORT char * belle_sip_create_tag(char *ret, size_t size);
BELLESIP_EXPORT
const
char
*
belle_sip_version_to_string
();
/**
* Returns string without surrounding quotes if any, else just call belle_sip_strdup().
**/
BELLESIP_EXPORT
char
*
belle_sip_unquote_strdup
(
const
char
*
str
);
#if defined(WIN32)
#include <winsock2.h>
...
...
src/belle_sip_utils.c
View file @
44bd1668
...
...
@@ -568,6 +568,26 @@ char* _belle_sip_str_dup_and_unquote_string(const char* quoted_string) {
return
unquoted_string
;
}
char
*
belle_sip_unquote_strdup
(
const
char
*
str
){
const
char
*
p
;
if
(
str
==
NULL
)
return
NULL
;
for
(
p
=
str
;
*
p
!=
'\0'
;
++
p
){
switch
(
*
p
){
case
' '
:
case
'\t'
:
break
;
case
'"'
:
return
_belle_sip_str_dup_and_unquote_string
(
p
);
default:
return
belle_sip_strdup
(
str
);
break
;
}
}
return
belle_sip_strdup
(
str
);
}
unsigned
int
belle_sip_random
(
void
){
#if defined(__linux) || defined(__APPLE__)
static
int
fd
=-
1
;
...
...
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