本文整理汇总了C++中osip_malloc函数的典型用法代码示例。如果您正苦于以下问题:C++ osip_malloc函数的具体用法?C++ osip_malloc怎么用?C++ osip_malloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osip_malloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sdp_time_descr_init
int
sdp_time_descr_init (sdp_time_descr_t ** td)
{
*td = (sdp_time_descr_t *) osip_malloc (sizeof (sdp_time_descr_t));
if (*td == NULL)
return -1;
(*td)->t_start_time = NULL;
(*td)->t_stop_time = NULL;
(*td)->r_repeats = (osip_list_t *) osip_malloc (sizeof (osip_list_t));
osip_list_init ((*td)->r_repeats);
return 0;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:12,代码来源:sdp_message.c
示例2: osip_content_type_parse
/* returns -1 on error. */
int osip_content_type_parse(osip_content_type_t * content_type, const char *hvalue)
{
char *subtype;
char *osip_content_type_params;
int i;
/* How to parse:
we'll place the pointers:
subtype => beginning of subtype
osip_content_type_params => beginning of params
examples:
application/multipart ; boundary=
^ ^
*/
if (hvalue == NULL || hvalue[0] == '\0')
return OSIP_SUCCESS; /* It's valid to add empty Accept header! */
subtype = strchr(hvalue, '/');
osip_content_type_params = strchr(hvalue, ';');
if (subtype == NULL)
return OSIP_SYNTAXERROR; /* do we really mind such an error */
if (osip_content_type_params != NULL) {
i = __osip_generic_param_parseall(&content_type->gen_params,
osip_content_type_params);
if (i != 0)
return i;
} else
osip_content_type_params = subtype + strlen(subtype);
if (subtype - hvalue + 1 < 2)
return OSIP_SYNTAXERROR;
content_type->type = (char *) osip_malloc(subtype - hvalue + 1);
if (content_type->type == NULL)
return OSIP_NOMEM;
osip_clrncpy(content_type->type, hvalue, subtype - hvalue);
if (osip_content_type_params - subtype < 2)
return OSIP_SYNTAXERROR;
content_type->subtype =
(char *) osip_malloc(osip_content_type_params - subtype);
if (content_type->subtype == NULL)
return OSIP_NOMEM;
osip_clrncpy(content_type->subtype, subtype + 1,
osip_content_type_params - subtype - 1);
return OSIP_SUCCESS;
}
开发者ID:avis,项目名称:osip,代码行数:53,代码来源:osip_content_type.c
示例3: while
//---------------------------------------------------------------------
void
Node::TransferUserInfoToPred(ChordId node)
{
uinfo_t *red_cur=red_user_info_list;
uinfo_t *cur=user_info_list;
while(red_cur != NULL)
{
char *red_aor;
uinfo_t *red_tmp=red_cur;
red_cur=red_cur->next;
osip_uri_to_str(red_tmp->aor->uri,&red_aor);
if(red_aor) osip_free(red_aor) ;
char * red_registrar= (char *)osip_malloc(4 + strlen(node.GetAddress()) +1) ;
sprintf (red_registrar, "sip:%s", node.GetAddress());
SndUserRegisterRequest(RED_REGISTER,red_tmp,red_registrar ,3600);
if(red_registrar) osip_free(red_registrar) ;
REMOVE_ELEMENT(red_user_info_list,red_tmp);
delete red_tmp;
}
ChordId localnode=getChordId();
unsigned int uid=0;
while(cur != NULL)
{
char *aor;
uinfo_t *tmp=cur;
cur=cur->next;
osip_uri_to_str(tmp->aor->uri,&aor);
uid=uhash(aor);
if(aor) osip_free(aor) ;
Constants constants(NULL);
ChordId UserID(uid,&constants);
if(!UserID.BelongsRightInclusive(node,localnode))
{
char * registrar= (char *)osip_malloc(4 + strlen(node.GetAddress()) +1) ;
sprintf (registrar, "sip:%s", node.GetAddress());
SndUserRegisterRequest(USER_REGISTRATION,tmp,registrar,3600);
if(registrar) osip_free(registrar) ;
REMOVE_ELEMENT(user_info_list,tmp);
//ADD_ELEMENT(red_user_info_list,tmp);//move this user info to redundant user info list
delete tmp;
}
}
}
开发者ID:inuyasha1027,项目名称:SI2P,代码行数:53,代码来源:Node.cpp
示例4: _eXosip_dialog_init_as_uas
int
_eXosip_dialog_init_as_uas (eXosip_dialog_t ** _jd, osip_message_t * _invite, osip_message_t * _200Ok)
{
int i;
eXosip_dialog_t *jd;
*_jd = NULL;
jd = (eXosip_dialog_t *) osip_malloc (sizeof (eXosip_dialog_t));
if (jd == NULL)
return OSIP_NOMEM;
memset (jd, 0, sizeof (eXosip_dialog_t));
jd->d_id = -1; /* not yet available to user */
i = osip_dialog_init_as_uas (&(jd->d_dialog), _invite, _200Ok);
if (i != 0) {
osip_free (jd);
return i;
}
jd->d_count = 0;
jd->d_session_timer_start = 0;
jd->d_session_timer_length = 0;
jd->d_session_timer_use_update = -1;
jd->d_refresher = -1; /* 0 -> me / 1 -> remote */
jd->d_timer = osip_getsystemtime (NULL);
jd->d_200Ok = NULL;
jd->d_ack = NULL;
jd->next = NULL;
jd->parent = NULL;
jd->d_out_trs = (osip_list_t *) osip_malloc (sizeof (osip_list_t));
if (jd->d_out_trs == NULL) {
osip_dialog_free (jd->d_dialog);
osip_free (jd);
return OSIP_NOMEM;
}
osip_list_init (jd->d_out_trs);
jd->d_inc_trs = (osip_list_t *) osip_malloc (sizeof (osip_list_t));
if (jd->d_inc_trs == NULL) {
osip_dialog_free (jd->d_dialog);
osip_free (jd->d_out_trs);
osip_free (jd);
return OSIP_NOMEM;
}
osip_list_init (jd->d_inc_trs);
jd->d_dialog->local_cseq = 1;
*_jd = jd;
return OSIP_SUCCESS;
}
开发者ID:CrazyBBer,项目名称:sip_stack,代码行数:49,代码来源:jdialog.c
示例5: osip_malloc
sdp_message_t *get_test_remote_message(int index, FILE *torture_file, int verbose)
{
sdp_message_t *remote_sdp;
char *msg;
char *tmpmsg;
char *tmp;
char *marker;
int i;
i = 0;
tmp = (char *) osip_malloc (500);
marker = fgets (tmp, 500, torture_file); /* lines are under 500 */
while (marker != NULL && i < index)
{
if (0 == strncmp (tmp, "|", 1))
i++;
marker = fgets (tmp, 500, torture_file);
}
msg = (char *) osip_malloc (10000); /* msg are under 10000 */
tmpmsg = msg;
if (marker == NULL)
{
fprintf (stderr,
"Error! The message's number you specified does not exist\n");
osip_free (msg);
return NULL; /* end of file detected! */
}
/* this part reads an entire message, separator is "|" */
/* (it is unlinkely that it will appear in messages!) */
while (marker != NULL && strncmp (tmp, "|", 1))
{
osip_strncpy (tmpmsg, tmp, strlen (tmp));
tmpmsg = tmpmsg + strlen (tmp);
marker = fgets (tmp, 500, torture_file);
}
if (verbose)
fprintf (stdout, "%s\n", msg);
i = sdp_message_init(&remote_sdp);
if (i!=0) return NULL;
i = sdp_message_parse(remote_sdp, msg);
if (i!=0) return NULL;
return remote_sdp;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:49,代码来源:torture_rfc3264.c
示例6: osip_accept_encoding_parse
int
osip_accept_encoding_parse (osip_accept_encoding_t * accept_encoding,
const char *hvalue)
{
const char *osip_accept_encoding_params;
osip_accept_encoding_params = strchr (hvalue, ';');
if (osip_accept_encoding_params != NULL)
{
if (__osip_generic_param_parseall (&accept_encoding->gen_params,
osip_accept_encoding_params) == -1)
return -1;
} else
osip_accept_encoding_params = hvalue + strlen (hvalue);
if (osip_accept_encoding_params - hvalue + 1 < 2)
return -1;
accept_encoding->element =
(char *) osip_malloc (osip_accept_encoding_params - hvalue + 1);
if (accept_encoding->element == NULL)
return -1;
osip_clrncpy (accept_encoding->element, hvalue,
osip_accept_encoding_params - hvalue);
return 0;
}
开发者ID:tws67,项目名称:bayonne-base-windows,代码行数:27,代码来源:osip_accept_encoding.c
示例7: jidentity_get_and_set_next_token
static int
jidentity_get_and_set_next_token (char **dest, char *buf, char **next)
{
char *end;
char *start;
*next = NULL;
/* find first non space and tab element */
start = buf;
while (((*start == ' ') || (*start == '\t')) && (*start != '\0')
&& (*start != '\r') && (*start != '\n') )
start++;
end = start+1;
while ((*end != '\0') && (*end != '\r') && (*end != '\n')
&& (*end != '\t') && (*end != '|'))
end++;
if ((*end == '\r') || (*end == '\n'))
/* we should continue normally only if this is the separator asked! */
return -1;
if (end == start)
return -1; /* empty value (or several space!) */
*dest = osip_malloc (end - (start) + 1);
osip_strncpy (*dest, start, end - start);
*next = end + 1; /* return the position right after the separator
*/
return 0;
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:31,代码来源:jidentity.c
示例8: osip_call_info_parse
int
osip_call_info_parse (osip_call_info_t * call_info, const char *hvalue)
{
const char *osip_call_info_params;
osip_call_info_params = strchr (hvalue, '<');
if (osip_call_info_params == NULL)
return -1;
osip_call_info_params = strchr (osip_call_info_params + 1, '>');
if (osip_call_info_params == NULL)
return -1;
osip_call_info_params = strchr (osip_call_info_params + 1, ';');
if (osip_call_info_params != NULL)
{
if (__osip_generic_param_parseall
(call_info->gen_params, osip_call_info_params) == -1)
return -1;
} else
osip_call_info_params = hvalue + strlen (hvalue);
if (osip_call_info_params - hvalue + 1 < 2)
return -1;
call_info->element = (char *) osip_malloc (osip_call_info_params - hvalue + 1);
if (call_info->element == NULL)
return -1;
osip_clrncpy (call_info->element, hvalue, osip_call_info_params - hvalue);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:sfsipua-svn,代码行数:32,代码来源:osip_call_info.c
示例9: osip_call_info_parse
int
osip_call_info_parse (osip_call_info_t * call_info, const char *hvalue)
{
const char *osip_call_info_params;
int i;
osip_call_info_params = strchr (hvalue, '<');
if (osip_call_info_params == NULL)
return OSIP_SYNTAXERROR;
osip_call_info_params = strchr (osip_call_info_params + 1, '>');
if (osip_call_info_params == NULL)
return OSIP_SYNTAXERROR;
osip_call_info_params = strchr (osip_call_info_params + 1, ';');
if (osip_call_info_params != NULL)
{
i = __osip_generic_param_parseall(&call_info->gen_params, osip_call_info_params);
if (i != 0)
return i;
} else
osip_call_info_params = hvalue + strlen (hvalue);
if (osip_call_info_params - hvalue + 1 < 2)
return OSIP_SYNTAXERROR;
call_info->element = (char *) osip_malloc (osip_call_info_params - hvalue + 1);
if (call_info->element == NULL)
return OSIP_NOMEM;
osip_clrncpy (call_info->element, hvalue, osip_call_info_params - hvalue);
return OSIP_SUCCESS;
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:33,代码来源:osip_call_info.c
示例10: vsnprintf
char *strdup_printf(const char *fmt, ...)
{
/* Guess we need no more than 100 bytes. */
int n, size = 100;
char *p;
va_list ap;
if ((p = osip_malloc (size)) == NULL)
return NULL;
while (1)
{
/* Try to print in the allocated space. */
va_start (ap, fmt);
#ifdef WIN32
n = _vsnprintf (p, size, fmt, ap);
#else
n = vsnprintf (p, size, fmt, ap);
#endif
va_end (ap);
/* If that worked, return the string. */
if (n > -1 && n < size)
return p;
/* Else try again with more space. */
if (n > -1) /* glibc 2.1 */
size = n + 1; /* precisely what is needed */
else /* glibc 2.0 */
size *= 2; /* twice the old size */
if ((p = realloc (p, size)) == NULL)
return NULL;
}
}
开发者ID:BackupTheBerlios,项目名称:ogmp-svn,代码行数:30,代码来源:eXutils.c
示例11: osip_enquote
char *
osip_enquote (const char *s)
{
char *rtn;
char *t;
t = rtn = osip_malloc (strlen (s) * 2 + 3);
*t++ = '"';
for (; *s != '\0'; s++)
{
switch (*s)
{
case '"':
case '\\':
case 0x7f:
*t++ = '\\';
*t++ = *s;
break;
case '\n':
case '\r':
*t++ = ' ';
break;
default:
*t++ = *s;
break;
}
}
*t++ = '"';
*t++ = '\0';
return rtn;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:31,代码来源:osip_port.c
示例12: osip_content_type_to_str
/* returns null on error. */
int
osip_content_type_to_str (const osip_content_type_t * content_type,
char **dest)
{
char *buf;
char *tmp;
size_t len;
*dest = NULL;
if ((content_type == NULL) || (content_type->type == NULL)
|| (content_type->subtype == NULL))
return -1;
/* try to guess a long enough length */
len = strlen (content_type->type) + strlen (content_type->subtype) + 4 /* for '/', ' ', ';' and '\0' */
+ 10 * osip_list_size (content_type->gen_params);
buf = (char *) osip_malloc (len);
tmp = buf;
sprintf (tmp, "%s/%s", content_type->type, content_type->subtype);
tmp = tmp + strlen (tmp);
{
int pos = 0;
osip_generic_param_t *u_param;
if (!osip_list_eol (content_type->gen_params, pos))
{ /* needed for cannonical form! (authentication issue of rfc2543) */
sprintf (tmp, " ");
tmp++;
}
while (!osip_list_eol (content_type->gen_params, pos))
{
size_t tmp_len;
u_param =
(osip_generic_param_t *) osip_list_get (content_type->gen_params,
pos);
if (u_param->gvalue == NULL)
{
osip_free (buf);
return -1;
}
tmp_len = strlen (buf) + 4 + strlen (u_param->gname)
+ strlen (u_param->gvalue);
if (len < tmp_len)
{
buf = osip_realloc (buf, tmp_len);
len = tmp_len;
tmp = buf + strlen (buf);
}
sprintf (tmp, ";%s=%s", u_param->gname, u_param->gvalue);
tmp = tmp + strlen (tmp);
pos++;
}
}
*dest = buf;
return 0;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:61,代码来源:osip_content_type.c
示例13: osip_header_to_str
/* returns null on error. */
int
osip_header_to_str (const osip_header_t * header, char **dest)
{
size_t len;
*dest = NULL;
if ((header == NULL) || (header->hname == NULL))
return OSIP_BADPARAMETER;
len = 0;
if (header->hvalue != NULL)
len = strlen (header->hvalue);
*dest = (char *) osip_malloc (strlen (header->hname) + len + 3);
if (*dest == NULL)
return OSIP_NOMEM;
if (header->hvalue != NULL)
sprintf (*dest, "%s: %s", header->hname, header->hvalue);
else
sprintf (*dest, "%s: ", header->hname);
if (*dest[0] > 'a' && *dest[0] < 'z')
*dest[0] = (*dest[0] - 32);
return OSIP_SUCCESS;
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:27,代码来源:osip_header.c
示例14: sdp_message_parse_v
int
sdp_message_parse_v (sdp_message_t * sdp, char *buf, char **next)
{
char *equal;
char *crlf;
*next = buf;
equal = buf;
while ((*equal != '=') && (*equal != '\0'))
equal++;
if (*equal == '\0')
return ERR_ERROR;
/* check if header is "v" */
if (equal[-1] != 'v')
return ERR_DISCARD;
crlf = equal + 1;
while ((*crlf != '\r') && (*crlf != '\n') && (*crlf != '\0'))
crlf++;
if (*crlf == '\0')
return ERR_ERROR;
if (crlf == equal + 1)
return ERR_ERROR; /*v=\r ?? bad header */
sdp->v_version = osip_malloc (crlf - (equal + 1) + 1);
osip_strncpy (sdp->v_version, equal + 1, crlf - (equal + 1));
if (crlf[1] == '\n')
*next = crlf + 2;
else
*next = crlf + 1;
return WF;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:35,代码来源:sdp_message.c
示例15: strlen
void
Node::TransferUserInfoToSucc(ChordId node)
{
uinfo_t *cur=user_info_list;
uinfo_t *red_cur=red_user_info_list;
char * succ= (char *)osip_malloc(4 + strlen(node.GetAddress()) +1) ;
sprintf (succ, "sip:%s", node.GetAddress());
const char *registrar=succ ;
//转移该节点负责的用户信息
while(cur != NULL)
{
uinfo_t *tmp=cur;
cur=tmp->next;
SndUserRegisterRequest(USER_REGISTRATION,tmp,registrar,3600);
REMOVE_ELEMENT(user_info_list,tmp);
delete tmp;
}
//转移该节点负责的冗余用户信息
while(red_cur != NULL)
{
uinfo_t *tmp2=red_cur;
red_cur=tmp2->next;
SndUserRegisterRequest(RED_REGISTER,tmp2,registrar,3600);
REMOVE_ELEMENT(red_user_info_list,tmp2);
delete tmp2;
}
if(succ) osip_free(succ) ;
}
开发者ID:inuyasha1027,项目名称:SI2P,代码行数:32,代码来源:Node.cpp
示例16: _osip_message_parse
/* osip_message_t *sip is filled while analysing buf */
static int
_osip_message_parse (osip_message_t * sip, const char *buf, size_t length, int sipfrag)
{
int i;
const char *next_header_index;
char *tmp;
char *beg;
tmp = osip_malloc (length + 2);
if (tmp == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "Could not allocate memory.\n"));
return OSIP_NOMEM;
}
beg = tmp;
memcpy (tmp, buf, length); /* may contain binary data */
tmp[length] = '\0';
/* skip initial \r\n */
while (tmp[0] == '\r' || tmp[0] == '\n')
tmp++;
osip_util_replace_all_lws (tmp);
/* parse request or status line */
i = __osip_message_startline_parse (sip, tmp, &next_header_index);
if (i != 0 && !sipfrag) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "Could not parse start line of message.\n"));
osip_free (beg);
return i;
}
tmp = (char *) next_header_index;
/* parse headers */
i = msg_headers_parse (sip, tmp, &next_header_index);
if (i != 0) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "error in msg_headers_parse()\n"));
osip_free (beg);
return i;
}
tmp = (char *) next_header_index;
/* this is a *very* simple test... (which handle most cases...) */
if (tmp[0] == '\0' || tmp[1] == '\0' || tmp[2] == '\0') {
/* this is mantory in the oSIP stack */
if (sip->content_length == NULL)
osip_message_set_content_length (sip, "0");
osip_free (beg);
return OSIP_SUCCESS; /* no body found */
}
i = msg_osip_body_parse (sip, tmp, &next_header_index, length - (tmp - beg));
osip_free (beg);
if (i != 0) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "error in msg_osip_body_parse()\n"));
return i;
}
/* this is mandatory in the oSIP stack */
if (sip->content_length == NULL)
osip_message_set_content_length (sip, "0");
return OSIP_SUCCESS;
}
开发者ID:CrazyBBer,项目名称:sip_stack,代码行数:61,代码来源:osip_message_parse.c
示例17: osip_accept_encoding_parse
int
osip_accept_encoding_parse(osip_accept_encoding_t * accept_encoding,
const char *hvalue)
{
int i;
const char *osip_accept_encoding_params;
osip_accept_encoding_params = strchr(hvalue, ';');
if (osip_accept_encoding_params != NULL) {
i = __osip_generic_param_parseall(&accept_encoding->gen_params,
osip_accept_encoding_params);
if (i != 0)
return i;
} else
osip_accept_encoding_params = hvalue + strlen(hvalue);
if (osip_accept_encoding_params - hvalue + 1 < 2)
return OSIP_SYNTAXERROR;
accept_encoding->element =
(char *) osip_malloc(osip_accept_encoding_params - hvalue + 1);
if (accept_encoding->element == NULL)
return OSIP_NOMEM;
osip_clrncpy(accept_encoding->element, hvalue,
osip_accept_encoding_params - hvalue);
return OSIP_SUCCESS;
}
开发者ID:AirDev,项目名称:linphone-android,代码行数:28,代码来源:osip_accept_encoding.c
示例18: __osip_set_next_token
/* __osip_set_next_token:
dest is the place where the value will be allocated
buf is the string where the value is searched
end_separator is the character that MUST be found at the end of the value
next is the final location of the separator + 1
the element MUST be found before any "\r" "\n" "\0" and
end_separator
return -1 on error
return 1 on success
*/
int __osip_set_next_token(char **dest, char *buf, int end_separator, char **next)
{
char *sep; /* separator */
*next = NULL;
sep = buf;
while ((*sep != end_separator) && (*sep != '\0') && (*sep != '\r')
&& (*sep != '\n'))
sep++;
if ((*sep == '\r') || (*sep == '\n')) { /* we should continue normally only if this is the separator asked! */
if (*sep != end_separator)
return OSIP_UNDEFINED_ERROR;
}
if (*sep == '\0')
return OSIP_UNDEFINED_ERROR; /* value must not end with this separator! */
if (sep == buf)
return OSIP_UNDEFINED_ERROR; /* empty value (or several space!) */
*dest = osip_malloc(sep - (buf) + 1);
if (*dest == NULL)
return OSIP_NOMEM;
osip_strncpy(*dest, buf, sep - buf);
*next = sep + 1; /* return the position right after the separator */
return OSIP_SUCCESS;
}
开发者ID:avis,项目名称:osip,代码行数:39,代码来源:osip_port.c
示例19: __osip_message_startline_to_strresp
static int __osip_message_startline_to_strresp(osip_message_t * sip, char **dest)
{
char *tmp;
const char *sip_version;
char status_code[5];
*dest = NULL;
if ((sip == NULL) || (sip->reason_phrase == NULL)
|| (sip->status_code < 100) || (sip->status_code > 699))
return OSIP_BADPARAMETER;
if (sip->sip_version == NULL)
sip_version = osip_protocol_version;
else
sip_version = sip->sip_version;
sprintf(status_code, "%u", sip->status_code);
*dest = (char *) osip_malloc(strlen(sip_version)
+ 3 + strlen(sip->reason_phrase) + 4);
if (*dest == NULL)
return OSIP_NOMEM;
tmp = *dest;
tmp = osip_str_append(tmp, sip_version);
*tmp = ' ';
tmp++;
tmp = osip_strn_append(tmp, status_code, 3);
*tmp = ' ';
tmp++;
strcpy(tmp, sip->reason_phrase);
return OSIP_SUCCESS;
}
开发者ID:AirDev,项目名称:linphone-android,代码行数:35,代码来源:osip_message_to_str.c
示例20: __osip_set_next_token_better
/* not yet done!!! :-)
*/
int
__osip_set_next_token_better (char **dest, char *buf, int end_separator,
int *forbidden_tab[], int size_tab, char **next)
{
char *sep; /* separator */
*next = NULL;
sep = buf;
while ((*sep != end_separator) && (*sep != '\0') && (*sep != '\r')
&& (*sep != '\n'))
sep++;
if ((*sep == '\r') && (*sep == '\n'))
{ /* we should continue normally only if this is the separator asked! */
if (*sep != end_separator)
return -1;
}
if (*sep == '\0')
return -1; /* value must not end with this separator! */
if (sep == buf)
return -1; /* empty value (or several space!) */
*dest = osip_malloc (sep - (buf) + 1);
osip_strncpy (*dest, buf, sep - buf);
*next = sep + 1; /* return the position right after the separator */
return 1;
}
开发者ID:tibastral,项目名称:symphonie,代码行数:30,代码来源:osip_port.c
注:本文中的osip_malloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论