Changeset 5875 for pjproject


Ignore:
Timestamp:
Sep 4, 2018 2:16:02 AM (6 years ago)
Author:
ming
Message:

Re #2100: Fix the optimization part of r5872, which didn't work since we don't preserve the old strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r5872 r5875  
    270270                                 pj_bool_t check_str) 
    271271{ 
     272    pjsua_srtp_opt backup_dst; 
     273     
     274    if (check_str) pj_memcpy(&backup_dst, dst, sizeof(*dst)); 
    272275    pj_memcpy(dst, src, sizeof(*src)); 
     276 
    273277    if (pool) { 
    274278        unsigned i; 
     
    279283            { 
    280284                pj_strdup(pool, &dst->crypto[i].key, &src->crypto[i].key); 
     285            } else { 
     286                /* If strings are identical, use the old string to 
     287                 * avoid wasting memory. 
     288                 */ 
     289                dst->crypto[i].key = backup_dst.crypto[i].key; 
    281290            } 
    282291            if (!check_str || 
     
    284293            { 
    285294                pj_strdup(pool, &dst->crypto[i].name, &src->crypto[i].name); 
     295            } else { 
     296                /* If strings are identical, use the old string to 
     297                 * avoid wasting memory. 
     298                 */ 
     299                dst->crypto[i].name = backup_dst.crypto[i].name; 
    286300            } 
    287301        } 
Note: See TracChangeset for help on using the changeset viewer.