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

(cherry picked from commit 99178b6329)
This commit is contained in:
Mark Andrews
2018-01-24 13:10:14 +11:00
parent c3dc955aea
commit fc04365d2f
3 changed files with 11 additions and 7 deletions

View File

@@ -1,3 +1,5 @@
4875. [bug] Address compile failures on older systems. [RT #47015]
4874. [bug] Wrong time display when reporting new keywarntime.
[RT #47042]

View File

@@ -28,7 +28,7 @@ struct isc_ht_node {
void *value;
isc_ht_node_t *next;
size_t keysize;
unsigned char key[];
unsigned char key[FLEXIBLE_ARRAY_MEMBER];
};
struct isc_ht {
@@ -101,7 +101,8 @@ isc_ht_destroy(isc_ht_t **htp) {
isc_ht_node_t *next = node->next;
ht->count--;
isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize);
offsetof(isc_ht_node_t, key) +
node->keysize);
node = next;
}
}
@@ -134,7 +135,7 @@ isc_ht_add(isc_ht_t *ht, const unsigned char *key,
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)
return (ISC_R_NOMEMORY);
@@ -192,7 +193,8 @@ isc_ht_delete(isc_ht_t *ht, const unsigned char *key, isc_uint32_t keysize) {
else
prev->next = node->next;
isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize);
offsetof(isc_ht_node_t, key) +
node->keysize);
ht->count--;
return (ISC_R_SUCCESS);
@@ -310,7 +312,7 @@ isc_ht_iter_delcurrent_next(isc_ht_iter_t *it) {
else
prev->next = node->next;
isc_mem_put(ht->mctx, node,
sizeof(isc_ht_node_t) + node->keysize);
offsetof(isc_ht_node_t, key) + node->keysize);
ht->count--;
return (result);

View File

@@ -10,10 +10,10 @@
#ifndef ISC_DEPRECATED_H
#define ISC_DEPRECATED_H
#ifdef __GNUC__
#if (__GNUC__ + 0) > 3
#define ISC_DEPRECATED __attribute__((deprecated))
#else
#define ISC_DEPRECATED /* none */
#endif /* __GNUC __ */
#endif /* __GNUC__ > 3*/
#endif