summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
Diffstat (limited to 'bus')
-rw-r--r--bus/activation.c21
-rw-r--r--bus/bus.c2
-rw-r--r--bus/config-loader-expat.c8
-rw-r--r--bus/config-parser.c26
-rw-r--r--bus/connection.c9
-rw-r--r--bus/desktop-file.c4
-rw-r--r--bus/dispatch.c4
-rw-r--r--bus/driver.c2
-rw-r--r--bus/main.c6
-rw-r--r--bus/services.c13
-rw-r--r--bus/test.c2
11 files changed, 34 insertions, 63 deletions
diff --git a/bus/activation.c b/bus/activation.c
index 8def99b9..fe069c79 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -204,13 +204,13 @@ load_directory (BusActivation *activation,
iter = NULL;
desktop_file = NULL;
- if (!_dbus_string_init (&filename, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&filename))
{
BUS_SET_OOM (error);
return FALSE;
}
- if (!_dbus_string_init (&full_path, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&full_path))
{
BUS_SET_OOM (error);
_dbus_string_free (&filename);
@@ -244,10 +244,8 @@ load_directory (BusActivation *activation,
if (!_dbus_string_ends_with_c_str (&filename, ".service"))
{
- const char *filename_c;
- _dbus_string_get_const_data (&filename, &filename_c);
_dbus_verbose ("Skipping non-.service file %s\n",
- filename_c);
+ _dbus_string_get_const_data (&filename));
continue;
}
@@ -255,11 +253,8 @@ load_directory (BusActivation *activation,
if (desktop_file == NULL)
{
- const char *full_path_c;
-
- _dbus_string_get_const_data (&full_path, &full_path_c);
-
- _dbus_verbose ("Could not load %s: %s\n", full_path_c,
+ _dbus_verbose ("Could not load %s: %s\n",
+ _dbus_string_get_const_data (&full_path),
tmp_error.message);
if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY))
@@ -274,15 +269,11 @@ load_directory (BusActivation *activation,
if (!add_desktop_file_entry (activation, desktop_file, &tmp_error))
{
- const char *full_path_c;
-
bus_desktop_file_free (desktop_file);
desktop_file = NULL;
-
- _dbus_string_get_const_data (&full_path, &full_path_c);
_dbus_verbose ("Could not add %s to activation entry list: %s\n",
- full_path_c, tmp_error.message);
+ _dbus_string_get_const_data (&full_path), tmp_error.message);
if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY))
{
diff --git a/bus/bus.c b/bus/bus.c
index 6d4f71b3..ca9802c0 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -184,7 +184,7 @@ bus_context_new (const DBusString *config_file,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- if (!_dbus_string_init (&full_address, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&full_address))
return NULL;
parser = NULL;
diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c
index 9988fb69..9e6de5e2 100644
--- a/bus/config-loader-expat.c
+++ b/bus/config-loader-expat.c
@@ -178,9 +178,9 @@ bus_config_load (const DBusString *file,
context.error = error;
context.failed = FALSE;
- _dbus_string_get_const_data (file, &filename);
+ filename = _dbus_string_get_const_data (file);
- if (!_dbus_string_init (&context.content, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&context.content))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
return NULL;
@@ -212,7 +212,7 @@ bus_config_load (const DBusString *file,
DBusString data;
const char *data_str;
- if (!_dbus_string_init (&data, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&data))
{
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto failed;
@@ -224,7 +224,7 @@ bus_config_load (const DBusString *file,
goto failed;
}
- _dbus_string_get_const_data (&data, &data_str);
+ data_str = _dbus_string_get_const_data (&data);
if (!XML_Parse (expat, data_str, _dbus_string_get_length (&data), TRUE))
{
diff --git a/bus/config-parser.c b/bus/config-parser.c
index bf4f6f7b..39239888 100644
--- a/bus/config-parser.c
+++ b/bus/config-parser.c
@@ -941,7 +941,7 @@ process_test_subdir (const DBusString *test_base_dir,
retval = FALSE;
dir = NULL;
- if (!_dbus_string_init (&test_directory, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&test_directory))
_dbus_assert_not_reached ("didn't allocate test_directory\n");
_dbus_string_init_const (&filename, subdir);
@@ -954,16 +954,15 @@ process_test_subdir (const DBusString *test_base_dir,
_dbus_assert_not_reached ("couldn't allocate full path");
_dbus_string_free (&filename);
- if (!_dbus_string_init (&filename, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&filename))
_dbus_assert_not_reached ("didn't allocate filename string\n");
dbus_error_init (&error);
dir = _dbus_directory_open (&test_directory, &error);
if (dir == NULL)
{
- const char *s;
- _dbus_string_get_const_data (&test_directory, &s);
- _dbus_warn ("Could not open %s: %s\n", s,
+ _dbus_warn ("Could not open %s: %s\n",
+ _dbus_string_get_const_data (&test_directory),
error.message);
dbus_error_free (&error);
goto failed;
@@ -977,7 +976,7 @@ process_test_subdir (const DBusString *test_base_dir,
DBusString full_path;
LoaderOomData d;
- if (!_dbus_string_init (&full_path, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&full_path))
_dbus_assert_not_reached ("couldn't init string");
if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
@@ -988,19 +987,13 @@ process_test_subdir (const DBusString *test_base_dir,
if (!_dbus_string_ends_with_c_str (&full_path, ".conf"))
{
- const char *filename_c;
- _dbus_string_get_const_data (&filename, &filename_c);
_dbus_verbose ("Skipping non-.conf file %s\n",
- filename_c);
+ _dbus_string_get_const_data (&filename));
_dbus_string_free (&full_path);
goto next;
}
- {
- const char *s;
- _dbus_string_get_const_data (&filename, &s);
- printf (" %s\n", s);
- }
+ printf (" %s\n", _dbus_string_get_const_data (&filename));
_dbus_verbose (" expecting %s\n",
validity == VALID ? "valid" :
@@ -1017,10 +1010,9 @@ process_test_subdir (const DBusString *test_base_dir,
if (dbus_error_is_set (&error))
{
- const char *s;
- _dbus_string_get_const_data (&test_directory, &s);
_dbus_warn ("Could not get next file in %s: %s\n",
- s, error.message);
+ _dbus_string_get_const_data (&test_directory),
+ error.message);
dbus_error_free (&error);
goto failed;
}
diff --git a/bus/connection.c b/bus/connection.c
index ee7d183c..3d83d96c 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -732,20 +732,17 @@ dbus_bool_t
bus_connection_set_name (DBusConnection *connection,
const DBusString *name)
{
- const char *c_name;
BusConnectionData *d;
d = BUS_CONNECTION_DATA (connection);
_dbus_assert (d != NULL);
_dbus_assert (d->name == NULL);
- _dbus_string_get_const_data (name, &c_name);
-
- d->name = _dbus_strdup (c_name);
-
- if (d->name == NULL)
+ if (!_dbus_string_copy_data (name, &d->name))
return FALSE;
+ _dbus_assert (d->name != NULL);
+
_dbus_verbose ("Name %s assigned to %p\n", d->name, connection);
return TRUE;
diff --git a/bus/desktop-file.c b/bus/desktop-file.c
index 13b709d2..08af768e 100644
--- a/bus/desktop-file.c
+++ b/bus/desktop-file.c
@@ -514,7 +514,7 @@ parse_key_value (BusDesktopFileParser *parser, DBusError *error)
return FALSE;
}
- if (!_dbus_string_init (&key, key_end - key_start))
+ if (!_dbus_string_init (&key))
{
parser_free (parser);
return FALSE;
@@ -613,7 +613,7 @@ bus_desktop_file_load (DBusString *filename,
return NULL;
}
- if (!_dbus_string_init (&str, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&str))
return NULL;
if (!_dbus_file_get_contents (&str, filename, error))
diff --git a/bus/dispatch.c b/bus/dispatch.c
index e75d8e6d..52214dbf 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -110,7 +110,7 @@ send_service_nonexistent_error (BusTransaction *transaction,
* bounce back an error message.
*/
- if (!_dbus_string_init (&error_message, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&error_message))
{
BUS_SET_OOM (error);
return FALSE;
@@ -125,7 +125,7 @@ send_service_nonexistent_error (BusTransaction *transaction,
return FALSE;
}
- _dbus_string_get_const_data (&error_message, &error_str);
+ error_str = _dbus_string_get_const_data (&error_message);
error_reply = dbus_message_new_error_reply (in_reply_to,
DBUS_ERROR_SERVICE_DOES_NOT_EXIST,
error_str);
diff --git a/bus/driver.c b/bus/driver.c
index 4946fd6a..8749bc13 100644
--- a/bus/driver.c
+++ b/bus/driver.c
@@ -278,7 +278,7 @@ bus_driver_handle_hello (DBusConnection *connection,
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
- if (!_dbus_string_init (&unique_name, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&unique_name))
{
BUS_SET_OOM (error);
return FALSE;
diff --git a/bus/main.c b/bus/main.c
index ae625489..fcde3493 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -51,10 +51,8 @@ check_two_config_files (const DBusString *config_file,
{
if (_dbus_string_get_length (config_file) > 0)
{
- const char *s;
- _dbus_string_get_const_data (config_file, &s);
fprintf (stderr, "--%s specified but configuration file %s already requested\n",
- extra_arg, s);
+ extra_arg, _dbus_string_get_const_data (config_file));
exit (1);
}
}
@@ -68,7 +66,7 @@ main (int argc, char **argv)
const char *prev_arg;
int i;
- if (!_dbus_string_init (&config_file, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&config_file))
return 1;
prev_arg = NULL;
diff --git a/bus/services.c b/bus/services.c
index d3ab1e59..8d4221fb 100644
--- a/bus/services.c
+++ b/bus/services.c
@@ -107,13 +107,10 @@ BusService*
bus_registry_lookup (BusRegistry *registry,
const DBusString *service_name)
{
- const char *c_name;
BusService *service;
-
- _dbus_string_get_const_data (service_name, &c_name);
service = _dbus_hash_table_lookup_string (registry->service_hash,
- c_name);
+ _dbus_string_get_const_data (service_name));
return service;
}
@@ -125,18 +122,15 @@ bus_registry_ensure (BusRegistry *registry,
BusTransaction *transaction,
DBusError *error)
{
- const char *c_name;
BusService *service;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
_dbus_assert (owner_if_created != NULL);
_dbus_assert (transaction != NULL);
-
- _dbus_string_get_const_data (service_name, &c_name);
service = _dbus_hash_table_lookup_string (registry->service_hash,
- c_name);
+ _dbus_string_get_const_data (service_name));
if (service != NULL)
return service;
@@ -149,8 +143,7 @@ bus_registry_ensure (BusRegistry *registry,
service->registry = registry;
- service->name = _dbus_strdup (c_name);
- if (service->name == NULL)
+ if (!_dbus_string_copy_data (service_name, &service->name))
{
_dbus_mem_pool_dealloc (registry->service_pool, service);
BUS_SET_OOM (error);
diff --git a/bus/test.c b/bus/test.c
index c492cccc..d6697085 100644
--- a/bus/test.c
+++ b/bus/test.c
@@ -296,7 +296,7 @@ bus_context_new_test (const DBusString *test_data_dir,
DBusString relative;
BusContext *context;
- if (!_dbus_string_init (&config_file, _DBUS_INT_MAX))
+ if (!_dbus_string_init (&config_file))
{
_dbus_warn ("No memory\n");
return NULL;