Commit fc04365d authored by Mark Andrews's avatar Mark Andrews
Browse files

4875. [bug] Address compile failures on older systems. [RT #47015]

(cherry picked from commit 99178b63)
parent c3dc955a
4875. [bug] Address compile failures on older systems. [RT #47015]
4874. [bug] Wrong time display when reporting new keywarntime. 4874. [bug] Wrong time display when reporting new keywarntime.
[RT #47042] [RT #47042]
   
......
...@@ -28,7 +28,7 @@ struct isc_ht_node { ...@@ -28,7 +28,7 @@ struct isc_ht_node {
void *value; void *value;
isc_ht_node_t *next; isc_ht_node_t *next;
size_t keysize; size_t keysize;
unsigned char key[]; unsigned char key[FLEXIBLE_ARRAY_MEMBER];
}; };
struct isc_ht { struct isc_ht {
...@@ -101,7 +101,8 @@ isc_ht_destroy(isc_ht_t **htp) { ...@@ -101,7 +101,8 @@ isc_ht_destroy(isc_ht_t **htp) {
isc_ht_node_t *next = node->next; isc_ht_node_t *next = node->next;
ht->count--; ht->count--;
isc_mem_put(ht->mctx, node, isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize); offsetof(isc_ht_node_t, key) +
node->keysize);
node = next; node = next;
} }
} }
...@@ -134,7 +135,7 @@ isc_ht_add(isc_ht_t *ht, const unsigned char *key, ...@@ -134,7 +135,7 @@ isc_ht_add(isc_ht_t *ht, const unsigned char *key,
node = node->next; node = node->next;
} }
node = isc_mem_get(ht->mctx, sizeof(isc_ht_node_t) + keysize); node = isc_mem_get(ht->mctx, offsetof(isc_ht_node_t, key) + keysize);
if (node == NULL) if (node == NULL)
return (ISC_R_NOMEMORY); return (ISC_R_NOMEMORY);
...@@ -192,7 +193,8 @@ isc_ht_delete(isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize) { ...@@ -192,7 +193,8 @@ isc_ht_delete(isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize) {
else else
prev->next = node->next; prev->next = node->next;
isc_mem_put(ht->mctx, node, isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize); offsetof(isc_ht_node_t, key) +
node->keysize);
ht->count--; ht->count--;
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
...@@ -310,7 +312,7 @@ isc_ht_iter_delcurrent_next(isc_ht_iter_t *it) { ...@@ -310,7 +312,7 @@ isc_ht_iter_delcurrent_next(isc_ht_iter_t *it) {
else else
prev->next = node->next; prev->next = node->next;
isc_mem_put(ht->mctx, node, isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize); offsetof(isc_ht_node_t, key) + node->keysize);
ht->count--; ht->count--;
return (result); return (result);
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#ifndef ISC_DEPRECATED_H #ifndef ISC_DEPRECATED_H
#define ISC_DEPRECATED_H #define ISC_DEPRECATED_H
#ifdef __GNUC__ #if (__GNUC__ + 0) > 3
#define ISC_DEPRECATED __attribute__((deprecated)) #define ISC_DEPRECATED __attribute__((deprecated))
#else #else
#define ISC_DEPRECATED /* none */ #define ISC_DEPRECATED /* none */
#endif /* __GNUC __ */ #endif /* __GNUC__ > 3*/
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment