Changeset 1329:175f2eb883a0 in freeDiameter for libfdcore
- Timestamp:
- Nov 27, 2017, 11:27:31 PM (6 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/hooks.c
r1307 r1329 196 196 197 197 /* Return the location of the permsgdata area corresponding to this handle, after eventually having created it. Return NULL in case of failure */ 198 static struct fd_hook_permsgdata * get_or_create_pmd(struct fd_msg_pmdl *pmdl, struct fd_hook_ hdl * h)198 static struct fd_hook_permsgdata * get_or_create_pmd(struct fd_msg_pmdl *pmdl, struct fd_hook_data_hdl * h) 199 199 { 200 200 struct fd_hook_permsgdata * ret = NULL; … … 210 210 for (li=pmdl->sentinel.next; li != &pmdl->sentinel; li = li->next) { 211 211 struct pmd_list_item * pli = (struct pmd_list_item *) li; 212 if (pli->hdl == h ->data_hdl)212 if (pli->hdl == h) 213 213 ret = &pli->pmd; 214 if (pli->hdl >= h ->data_hdl)214 if (pli->hdl >= h) 215 215 break; 216 216 } … … 218 218 /* we need to create a new one and insert before li */ 219 219 struct pmd_list_item * pli; 220 CHECK_MALLOC_DO( pli = malloc(sizeof_pmd(h ->data_hdl)), );220 CHECK_MALLOC_DO( pli = malloc(sizeof_pmd(h)), ); 221 221 if (pli) { 222 memset(pli, 0, sizeof_pmd(h ->data_hdl));222 memset(pli, 0, sizeof_pmd(h)); 223 223 fd_list_init(&pli->chain, pli); 224 pli->hdl = h ->data_hdl;224 pli->hdl = h; 225 225 ret = &pli->pmd; 226 if (h-> data_hdl->pmd_init_cb) {227 (*h-> data_hdl->pmd_init_cb)(ret);226 if (h->pmd_init_cb) { 227 (*h->pmd_init_cb)(ret); 228 228 } 229 229 fd_list_insert_before(li, &pli->chain); … … 233 233 CHECK_POSIX_DO( pthread_mutex_unlock(&pmdl->lock), ); 234 234 return ret; 235 } 236 237 struct fd_hook_permsgdata * fd_hook_get_pmd(struct fd_hook_data_hdl *data_hdl, struct msg * msg) 238 { 239 return get_or_create_pmd(fd_msg_pmdl_get(msg), data_hdl); 235 240 } 236 241 … … 307 312 /* do we need to handle pmd ? */ 308 313 if (h->data_hdl && pmdl) { 309 pmd = get_or_create_pmd(pmdl, h );314 pmd = get_or_create_pmd(pmdl, h->data_hdl); 310 315 } 311 316
Note: See TracChangeset
for help on using the changeset viewer.