Changeset 263 for pjproject/trunk
- Timestamp:
- Mar 2, 2006 9:12:28 PM (19 years ago)
- Location:
- pjproject/trunk/pjlib/include/pj
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj/string.h
r180 r263 216 216 * Duplicate string and NULL terminate the destination string. 217 217 * 218 * @param pool 219 * @param dst 220 * @param src 218 * @param pool The pool. 219 * @param dst The string result. 220 * @param src The string to duplicate. 221 * 222 * @return The string result. 221 223 */ 222 224 PJ_IDECL(pj_str_t*) pj_strdup_with_null(pj_pool_t *pool, … … 236 238 pj_str_t *dst, 237 239 const char *src); 240 241 /** 242 * Duplicate string and NULL terminate the destination string. 243 * 244 * @param pool The pool. 245 * @param dst The string result. 246 * @param src The string to duplicate. 247 * 248 * @return The string result. 249 */ 250 PJ_IDECL(pj_str_t*) pj_strdup2_with_null(pj_pool_t *pool, 251 pj_str_t *dst, 252 const char *src); 253 238 254 239 255 /** -
pjproject/trunk/pjlib/include/pj/string_i.h
r180 r263 44 44 const pj_str_t *src) 45 45 { 46 dst->ptr = (char*)pj_pool_alloc(pool, src->slen+1); 46 47 if (src->slen) { 47 dst->ptr = (char*)pj_pool_alloc(pool, src->slen+1);48 48 pj_memcpy(dst->ptr, src->ptr, src->slen); 49 } else {50 dst->ptr = (char*)pj_pool_alloc(pool, 1);51 49 } 52 50 dst->slen = src->slen; … … 69 67 } 70 68 69 PJ_IDEF(pj_str_t*) pj_strdup2_with_null( pj_pool_t *pool, 70 pj_str_t *dst, 71 const char *src) 72 { 73 dst->slen = src ? pj_ansi_strlen(src) : 0; 74 dst->ptr = (char*)pj_pool_alloc(pool, dst->slen+1); 75 if (dst->slen) { 76 pj_memcpy(dst->ptr, src, dst->slen); 77 } 78 dst->ptr[dst->slen] = '\0'; 79 return dst; 80 } 71 81 72 82 PJ_IDEF(pj_str_t) pj_strdup3(pj_pool_t *pool, const char *src)
Note: See TracChangeset
for help on using the changeset viewer.