Changeset 116 for pjproject


Ignore:
Timestamp:
Jan 8, 2006 11:57:07 PM (19 years ago)
Author:
bennylp
Message:

Do not allow modules with the same name to be registered

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c

    r109 r116  
    126126 
    127127 
     128/* Compare module name, used for searching module based on name. */ 
     129static int cmp_mod_name(void *name, const pjsip_module *mod) 
     130{ 
     131    return pj_stricmp(name, &mod->name); 
     132} 
     133 
    128134/* 
    129135 * Register new module to the endpoint. 
     
    144150    PJ_ASSERT_ON_FAIL(  pj_list_find_node(&endpt->module_list, mod) == NULL, 
    145151                        {status = PJ_EEXISTS; goto on_return;}); 
     152 
     153    /* Make sure that no module with the same name has been registered. */ 
     154    PJ_ASSERT_ON_FAIL(  pj_list_search(&endpt->module_list, &mod->name,  
     155                                       &cmp_mod_name)==NULL, 
     156                        {status = PJ_EEXISTS; goto on_return; }); 
    146157 
    147158    /* Find unused ID for this module. */ 
Note: See TracChangeset for help on using the changeset viewer.