Module: kamailio Branch: master Commit: 65a296b3478503ed3519ea9156d8f46f5cb9ce2a URL: https://github.com/kamailio/kamailio/commit/65a296b3478503ed3519ea9156d8f46f...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-01-27T10:20:49+01:00
htable: wrapped maco code in do {} while(0)
---
Modified: src/modules/htable/ht_api.h
---
Diff: https://github.com/kamailio/kamailio/commit/65a296b3478503ed3519ea9156d8f46f... Patch: https://github.com/kamailio/kamailio/commit/65a296b3478503ed3519ea9156d8f46f...
---
diff --git a/src/modules/htable/ht_api.h b/src/modules/htable/ht_api.h index 4e0757f237b..d9fc187e722 100644 --- a/src/modules/htable/ht_api.h +++ b/src/modules/htable/ht_api.h @@ -144,10 +144,19 @@ ht_cell_t *ht_iterator_get_current(str *iname); void ht_slot_lock(ht_t *ht, int idx); void ht_slot_unlock(ht_t *ht, int idx);
-#define HT_UPDATE_EXPIRE(ht, it, now) \ - if(ht->updateexpire || (now && it->expire && it->expire < now)) \ - it->expire = now + ht->htexpire -#define HT_COPY_EXPIRE(ht, it, now, src) \ - HT_UPDATE_EXPIRE(ht, it, now); \ - else it->expire = src->expire +#define HT_UPDATE_EXPIRE(ht, it, now) \ + do { \ + if(ht->updateexpire || (now && it->expire && it->expire < now)) { \ + it->expire = now + ht->htexpire; \ + } \ + } while(0) +#define HT_COPY_EXPIRE(ht, it, now, src) \ + do { \ + if(ht->updateexpire || (now && it->expire && it->expire < now)) { \ + it->expire = now + ht->htexpire; \ + } else { \ + it->expire = src->expire; \ + } \ + } while(0) + #endif