diff options
author | George Lebl <jirka@5z.com> | 2000-06-18 09:54:57 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2000-06-18 09:54:57 +0000 |
commit | 30675e99d6a6ffadd366bfe128863c005f5e1d13 (patch) | |
tree | a0094251089aa887639100b5d1e0b08cdefa48e7 /test | |
parent | 3db19cf0ab2fc138fd9c1e6c2e3ad6f2bd91d8c9 (diff) | |
download | nautilus-30675e99d6a6ffadd366bfe128863c005f5e1d13.tar.gz |
s/g_str_freev/g_strfreev/ as that's the correct glib name
Sun Jun 18 02:50:47 2000 George Lebl <jirka@5z.com>
* components/help/help-method.c (file_in_info_path):
s/g_str_freev/g_strfreev/ as that's the correct glib name
* components/help/hyperbola-main.c,
components/help/hyperbola-nav-index.c,
components/help/hyperbola-nav-search.c
components/help/hyperbola-nav-tree.c,
components/help/hyperbola-nav.h: Use hyperbola-nav.h as a header
to put the prototypes from the hyperbola-nav-*.c files. And
include this file in hyperbola-main.c and hyperbola-nav-*.c
* libnautilus-extensions/nautilus-global-preferences.c
(global_preferences_register_boolean_with_defaults)
(global_preferences_register_enum_with_defaults),
libnautilus-extensions/nautilus-preferences.c
(preferences_hash_node_check_changes_func)
(user_level_changed_callback):
use GU?INT_TO_POINTER and GPOINTER_TO_U?INT macros to get and pass
ints and uints as pointers.
* librsvg/rsvg-bpath-util.c, test/nautilus-leak-checker.c:
include <string.h>
* test/nautilus-leak-checker.c (nautilus_leak_record_malloc)
(nautilus_leak_record_realloc) (nautilus_leak_record_free)
(print_one_leak): Store pointers in gulongs not guints and
when printing size_t, cast to long and use %ld.
* test/nautilus-leak-symbol-lookup.c
(nautilus_leak_symbol_map_get_offsets): When reading in gint64,
check if long is actually 64bit, in which case use %lx otherwise
use %Lx for sscanf.
Diffstat (limited to 'test')
-rw-r--r-- | test/nautilus-leak-checker.c | 27 | ||||
-rw-r--r-- | test/nautilus-leak-symbol-lookup.c | 6 |
2 files changed, 20 insertions, 13 deletions
diff --git a/test/nautilus-leak-checker.c b/test/nautilus-leak-checker.c index c8b1c4071..8e17afc15 100644 --- a/test/nautilus-leak-checker.c +++ b/test/nautilus-leak-checker.c @@ -31,6 +31,7 @@ #include <malloc.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "nautilus-leak-checker-stubs.h" #include "nautilus-leak-hash-table.h" @@ -255,13 +256,13 @@ nautilus_leak_record_malloc (void *ptr, size_t size) if (hash_table == NULL) { hash_table = nautilus_leak_hash_table_new (10 * 1024); } - if (nautilus_leak_hash_table_find (hash_table, (guint)ptr) != NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)ptr) != NULL) { printf("*** block %p appears to already be allocated " "- someone must have sneaked a free past us\n", ptr); - nautilus_leak_hash_table_remove (hash_table, (guint)ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)ptr); } /* insert a new item into the hash table, using the block address as the key */ - element = nautilus_leak_hash_table_add (hash_table, (guint)ptr); + element = nautilus_leak_hash_table_add (hash_table, (gulong)ptr); /* fill out the new allocated element */ nautilus_leak_allocation_record_init (&element->data, ptr, size, trace_array, TRACE_ARRAY_MAX); @@ -287,22 +288,22 @@ nautilus_leak_record_realloc (void *old_ptr, void *new_ptr, size_t size) /* must have hash table by now */ g_assert (hash_table != NULL); /* must have seen the block already */ - if (nautilus_leak_hash_table_find (hash_table, (guint)old_ptr) == NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)old_ptr) == NULL) { printf("*** we haven't seen block %p yet " "- someone must have sneaked a malloc past us\n", old_ptr); } else { - nautilus_leak_hash_table_remove (hash_table, (guint)old_ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)old_ptr); } /* shouldn't have this block yet */ - if (nautilus_leak_hash_table_find (hash_table, (guint)new_ptr) != NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)new_ptr) != NULL) { printf("*** block %p appears to already be allocated " "- someone must have sneaked a free past us\n", new_ptr); - nautilus_leak_hash_table_remove (hash_table, (guint)new_ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)new_ptr); } /* insert a new item into the hash table, using the block address as the key */ - element = nautilus_leak_hash_table_add (hash_table, (guint)new_ptr); + element = nautilus_leak_hash_table_add (hash_table, (gulong)new_ptr); /* Fill out the new allocated element. * This way the last call to relloc will be the stack crawl that shows up in the @@ -327,11 +328,11 @@ nautilus_leak_record_free (void *ptr) /* must have hash table by now */ g_assert (hash_table != NULL); /* must have seen the block already */ - if (nautilus_leak_hash_table_find (hash_table, (guint)ptr) == NULL) { + if (nautilus_leak_hash_table_find (hash_table, (gulong)ptr) == NULL) { printf("*** we haven't seen block %p yet " "- someone must have sneaked a malloc past us\n", ptr); } else { - nautilus_leak_hash_table_remove (hash_table, (guint)ptr); + nautilus_leak_hash_table_remove (hash_table, (gulong)ptr); } pthread_mutex_unlock (&nautilus_leak_hash_table_mutex); @@ -513,8 +514,8 @@ print_one_leak (NautilusLeakTableEntry *entry, void *context) int index; PrintOneLeakParams *params = (PrintOneLeakParams *)context; - printf("block %p total_size %d count %d\n", entry->sample_allocation->block, - entry->total_size, entry->count); + printf("block %p total_size %ld count %d\n", entry->sample_allocation->block, + (long)entry->total_size, entry->count); for (index = 0; index < params->stack_print_depth; index++) { /* only print stack_grouping worth of stack crawl - @@ -715,4 +716,4 @@ main (int argc, char **argv) } -#endif
\ No newline at end of file +#endif diff --git a/test/nautilus-leak-symbol-lookup.c b/test/nautilus-leak-symbol-lookup.c index d7f8b8640..105b8d014 100644 --- a/test/nautilus-leak-symbol-lookup.c +++ b/test/nautilus-leak-symbol-lookup.c @@ -103,8 +103,14 @@ nautilus_leak_symbol_map_get_offsets (NautilusLeakSymbolLookupMap *map) while (fgets(buffer, 1023, in)) { +/* if long is in fact the int64 type */ +#if G_MAXLONG == 9223372036854775807 + count = sscanf (buffer, "%lx-%lx %15s %*x %u:%u %lu %255s", + &start, &end, perms, &major, &minor, &inode, file); +#else count = sscanf (buffer, "%Lx-%Lx %15s %*x %u:%u %Lu %255s", &start, &end, perms, &major, &minor, &inode, file); +#endif if (count >= 6 && strcmp (perms, "r-xp") == 0) { if (stat (file, &entry_stat) != 0) { |