@@ -194,12 +194,13 @@ static void ngx_http_clojure_shared_map_hashmap_invoke_value_handler_helper(ngx_
194
194
static ngx_int_t ngx_http_clojure_shared_map_hashmap_set_key_helper (ngx_slab_pool_t * shpool , ngx_http_clojure_hashmap_entry_t * entry ,
195
195
const void * key , size_t klen ) {
196
196
197
+ void * ek = & entry -> key ; /* *((uint64_t *)(void*)&entry->key) will cause gcc 4.4 warning*/
197
198
switch (entry -> ktype ) {
198
199
case NGX_CLOJURE_SHARED_MAP_JINT :
199
- * ((uint32_t * )( void * ) & entry -> key ) = * ((uint32_t * )key );
200
+ * ((uint32_t * )ek ) = * ((uint32_t * )key );
200
201
return NGX_CLOJURE_SHARED_MAP_OK ;
201
202
case NGX_CLOJURE_SHARED_MAP_JLONG :
202
- * ((uint64_t * )( void * ) & entry -> key ) = * ((uint64_t * ) key );
203
+ * ((uint64_t * )ek ) = * ((uint64_t * ) key );
203
204
return NGX_CLOJURE_SHARED_MAP_OK ;
204
205
case NGX_CLOJURE_SHARED_MAP_JSTRING :
205
206
case NGX_CLOJURE_SHARED_MAP_JBYTEA :
@@ -219,6 +220,7 @@ static ngx_int_t ngx_http_clojure_shared_map_hashmap_set_value_helper(ngx_slab_p
219
220
uint8_t vtype , const void * val , size_t vlen , ngx_http_clojure_shared_map_val_handler old_handler , void * handler_data ) {
220
221
void * oldv = NULL ;
221
222
size_t oldv_size = 0 ;
223
+ void * ev = & entry -> val ; /* *((uint64_t *)(void*)&entry->val) will cause gcc 4.4 warning*/
222
224
223
225
switch (entry -> vtype ) {
224
226
case NGX_CLOJURE_SHARED_MAP_JINT :
@@ -246,10 +248,10 @@ static ngx_int_t ngx_http_clojure_shared_map_hashmap_set_value_helper(ngx_slab_p
246
248
247
249
switch (vtype ) {
248
250
case NGX_CLOJURE_SHARED_MAP_JINT :
249
- * ((uint32_t * )( void * ) & entry -> val ) = * ((uint32_t * )val );
251
+ * ((uint32_t * )ev ) = * ((uint32_t * )val );
250
252
goto HANDLE_CPX_OLDV ;
251
253
case NGX_CLOJURE_SHARED_MAP_JLONG :
252
- * ((uint64_t * )( void * ) & entry -> val ) = * ((uint64_t * ) val );
254
+ * ((uint64_t * )ev ) = * ((uint64_t * ) val );
253
255
goto HANDLE_CPX_OLDV ;
254
256
case NGX_CLOJURE_SHARED_MAP_JSTRING :
255
257
case NGX_CLOJURE_SHARED_MAP_JBYTEA :
@@ -278,17 +280,18 @@ static ngx_int_t ngx_http_clojure_shared_map_hashmap_set_value_helper(ngx_slab_p
278
280
static ngx_int_t ngx_http_clojure_shared_map_hashmap_match_key (uint8_t ktype ,
279
281
const u_char * key , size_t klen , uint32_t hash ,
280
282
ngx_http_clojure_hashmap_entry_t * entry ) {
283
+ void * ek = & entry -> key ; /* *((uint64_t *)(void*)&entry->key) will cause gcc 4.4 warning*/
281
284
if (ktype != entry -> ktype ) {
282
285
return NGX_CLOJURE_SHARED_MAP_NOT_FOUND ;
283
286
}
284
287
switch (ktype ) {
285
288
case NGX_CLOJURE_SHARED_MAP_JINT :
286
- if (* ((uint32_t * )( void * ) & entry -> key ) == * ((uint32_t * ) key )) {
289
+ if (* ((uint32_t * )ek ) == * ((uint32_t * ) key )) {
287
290
return NGX_CLOJURE_SHARED_MAP_OK ;
288
291
}
289
292
break ;
290
293
case NGX_CLOJURE_SHARED_MAP_JLONG :
291
- if (* ((uint64_t * )( void * ) & entry -> key ) == * ((uint64_t * ) key )) {
294
+ if (* ((uint64_t * )ek ) == * ((uint64_t * ) key )) {
292
295
return NGX_CLOJURE_SHARED_MAP_OK ;
293
296
}
294
297
break ;
@@ -348,7 +351,8 @@ ngx_int_t ngx_http_clojure_shared_map_hashmap_put_entry(ngx_http_clojure_shared_
348
351
349
352
ngx_shmtx_lock (& ctx -> shpool -> mutex );
350
353
for (pentry = & ctx -> map -> table [index_for (hash , ctx -> entry_table_size )];
351
- (entry = * pentry ) != NULL ; pentry = & entry -> next ) {
354
+ (entry = * pentry ) != NULL ;
355
+ pentry = (void * )& entry -> next ) {
352
356
if (NGX_CLOJURE_SHARED_MAP_OK == (rc = ngx_http_clojure_shared_map_hashmap_match_key (ktype , key , klen , hash , entry ))) {
353
357
rc = ngx_http_clojure_shared_map_hashmap_set_value_helper (ctx -> shpool , entry , vtype , val , vlen , old_val_handler , handler_data );
354
358
ngx_shmtx_unlock (& ctx -> shpool -> mutex );
@@ -403,7 +407,8 @@ ngx_int_t ngx_http_clojure_shared_map_hashmap_put_entry_if_absent(ngx_http_cloju
403
407
404
408
ngx_shmtx_lock (& ctx -> shpool -> mutex );
405
409
for (pentry = & ctx -> map -> table [index_for (hash , ctx -> entry_table_size )];
406
- (entry = * pentry ) != NULL ; pentry = & entry -> next ) {
410
+ (entry = * pentry ) != NULL ;
411
+ pentry = (void * )& entry -> next ) {
407
412
if (NGX_CLOJURE_SHARED_MAP_OK == (rc = ngx_http_clojure_shared_map_hashmap_match_key (ktype , key , klen , hash , entry ))) {
408
413
if (old_val_handler ) {
409
414
ngx_http_clojure_shared_map_hashmap_invoke_value_handler_helper (entry , old_val_handler , handler_data );
@@ -462,7 +467,8 @@ ngx_int_t ngx_http_clojure_shared_map_hashmap_remove_entry(ngx_http_clojure_shar
462
467
463
468
ngx_shmtx_lock (& ctx -> shpool -> mutex );
464
469
for (pentry = & ctx -> map -> table [index_for (hash , ctx -> entry_table_size )];
465
- (entry = * pentry ) != NULL ; pentry = & entry -> next ) {
470
+ (entry = * pentry ) != NULL ;
471
+ pentry = (void * )& entry -> next ) {
466
472
if (NGX_CLOJURE_SHARED_MAP_OK == (rc = ngx_http_clojure_shared_map_hashmap_match_key (ktype , key , klen , hash , entry ))) {
467
473
if (val_handler ) {
468
474
ngx_http_clojure_shared_map_hashmap_invoke_value_handler_helper (entry , val_handler , handler_data );
0 commit comments