1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-29 03:17:53 -04:00

Revert "Killed warnings: uri_cache always evaluate as true"

This reverts commit f0717304f0.
This commit is contained in:
Witold Filipczyk 2007-02-18 09:42:20 +01:00 committed by Witold Filipczyk
parent dc1b84bafd
commit f8c0fe013b
2 changed files with 3 additions and 34 deletions

View File

@ -47,20 +47,11 @@ struct object_head {
if_assert_failed (obj)->object.refcount = 0; \
} while (0)
#define object_sanity_check_without_assert(obj) \
do { \
assertm((obj)->object.refcount >= 0, \
"Object %s[%p] refcount underflow.", \
(obj)->object.name, obj); \
if_assert_failed (obj)->object.refcount = 0; \
} while (0)
#define object_set_name(obj, objname) \
do { (obj)->object.name = (objname); } while (0)
#define INIT_OBJECT(name) { 0, name }
#else
#define object_sanity_check(obj)
#define object_sanity_check_without_assert(obj)
#define object_set_name(obj, name)
#define INIT_OBJECT(name) { 0 }
#endif /* CONFIG_DEBUG */
@ -90,26 +81,4 @@ struct object_head {
object_lock_debug(obj, "initialized"); \
} while (0)
/* These macros are here because of gcc warnings in uri.c . --witekfl */
#define object_lock_without_assert(obj) \
do { \
object_sanity_check_without_assert(obj); \
(obj)->object.refcount++; \
object_lock_debug(obj, "incremented"); \
} while (0)
#define object_unlock_without_assert(obj) \
do { \
(obj)->object.refcount--; \
object_lock_debug(obj, "decremented"); \
object_sanity_check_without_assert(obj); \
} while (0)
#define object_nolock_without_assert(obj, name) \
do { \
object_set_name(obj, name); \
object_sanity_check_without_assert(obj); \
object_lock_debug(obj, "initialized"); \
} while (0)
#endif

View File

@ -1532,7 +1532,7 @@ get_uri_cache_entry(unsigned char *string, int length)
return NULL;
}
object_lock_without_assert(&uri_cache); /* was warning */
object_lock(&uri_cache);
return entry;
}
@ -1556,7 +1556,7 @@ get_uri(unsigned char *string, enum uri_component components)
if (!is_object_used(&uri_cache)) {
uri_cache.map = init_hash8();
if (!uri_cache.map) return NULL;
object_nolock_without_assert(&uri_cache, "uri_cache");
object_nolock(&uri_cache, "uri_cache");
}
entry = get_uri_cache_entry(string, strlen(string));
@ -1594,7 +1594,7 @@ done_uri(struct uri *uri)
mem_free(entry);
/* Last URI frees the cache */
object_unlock_without_assert(&uri_cache);
object_unlock(&uri_cache);
if (!is_object_used(&uri_cache))
free_hash(&uri_cache.map);
}