strdup the string to remove compiler warnings

2001-07-17  Bradford Hovinen  <hovinen@ximian.com>

	* archive.c (archive_unregister_location):
	(archive_get_location): strdup the string to remove compiler warnings
This commit is contained in:
Bradford Hovinen 2001-07-17 19:08:55 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent 313127a2e5
commit 31a81628c4
2 changed files with 15 additions and 6 deletions

View file

@ -1,5 +1,8 @@
2001-07-17 Bradford Hovinen <hovinen@ximian.com> 2001-07-17 Bradford Hovinen <hovinen@ximian.com>
* archive.c (archive_unregister_location):
(archive_get_location): strdup the string to remove compiler warnings
* location.c (location_store): Use return value * location.c (location_store): Use return value
(location_store_full_snapshot): Use return value (location_store_full_snapshot): Use return value

View file

@ -337,12 +337,16 @@ Location *
archive_get_location (Archive *archive, const gchar *locid) archive_get_location (Archive *archive, const gchar *locid)
{ {
GtkObject *loc_obj; GtkObject *loc_obj;
gchar *tmp;
g_return_val_if_fail (archive != NULL, NULL); g_return_val_if_fail (archive != NULL, NULL);
g_return_val_if_fail (IS_ARCHIVE (archive), NULL); g_return_val_if_fail (IS_ARCHIVE (archive), NULL);
g_return_val_if_fail (locid != NULL, NULL); g_return_val_if_fail (locid != NULL, NULL);
loc_obj = g_tree_lookup (archive->locations, locid); /* Stupid borken glib... */
tmp = g_strdup (locid);
loc_obj = g_tree_lookup (archive->locations, tmp);
g_free (tmp);
if (!loc_obj) { if (!loc_obj) {
loc_obj = location_open (archive, locid); loc_obj = location_open (archive, locid);
@ -394,6 +398,8 @@ archive_register_location (Archive *archive, Location *location)
void void
archive_unregister_location (Archive *archive, Location *location) archive_unregister_location (Archive *archive, Location *location)
{ {
gchar *tmp;
g_return_if_fail (archive != NULL); g_return_if_fail (archive != NULL);
g_return_if_fail (IS_ARCHIVE (archive)); g_return_if_fail (IS_ARCHIVE (archive));
g_return_if_fail (location != NULL); g_return_if_fail (location != NULL);
@ -401,7 +407,9 @@ archive_unregister_location (Archive *archive, Location *location)
if (GTK_OBJECT_DESTROYED (archive)) return; if (GTK_OBJECT_DESTROYED (archive)) return;
g_tree_remove (archive->locations, location_get_id (location)); tmp = g_strdup (location_get_id (location));
g_tree_remove (archive->locations, tmp);
g_free (tmp);
} }
/** /**
@ -417,13 +425,11 @@ archive_unregister_location (Archive *archive, Location *location)
Location * Location *
archive_get_current_location (Archive *archive) archive_get_current_location (Archive *archive)
{ {
gchar *locid; const gchar *locid = archive_get_current_location_id (archive);
g_return_val_if_fail (archive != NULL, NULL); g_return_val_if_fail (archive != NULL, NULL);
g_return_val_if_fail (IS_ARCHIVE (archive), NULL); g_return_val_if_fail (IS_ARCHIVE (archive), NULL);
locid = archive_get_current_location_id (archive);
if (locid == NULL) if (locid == NULL)
return NULL; return NULL;
else else