2003-02-13 Anders Carlsson <andersca@codefactory.se>
+ * bus/Makefile.am:
+ Add utils.[ch]
+
+ * bus/connection.c: (bus_connection_foreach):
+ Fix a warning.
+
+ * bus/desktop-file.c: (grow_lines_in_section), (grow_sections),
+ (unescape_string), (new_section), (parse_section_start),
+ (parse_key_value), (report_error), (bus_desktop_file_load),
+ (bus_desktop_file_get_string):
+ * bus/desktop-file.h:
+ Use DBusError for error reporting.
+
+ * bus/dispatch.c: (send_one_message),
+ (bus_dispatch_message_handler):
+ * bus/driver.c: (bus_driver_send_service_deleted),
+ (bus_driver_send_service_created), (bus_driver_send_service_lost),
+ (bus_driver_send_service_acquired), (bus_driver_handle_hello),
+ (bus_driver_send_welcome_message),
+ (bus_driver_handle_list_services),
+ (bus_driver_handle_acquire_service),
+ (bus_driver_handle_service_exists):
+ * bus/loop.c: (bus_loop_run):
+ * bus/main.c:
+ Use BUS_HANDLE_OOM instead of _DBUS_HANDLE_OOM.
+
+ * bus/utils.c: (bus_wait_for_memory):
+ * bus/utils.h:
+ New files with general utility functions.
+
+ * dbus/dbus-internals.h:
+ Remove _DBUS_HANDLE_OOM.
+
+2003-02-13 Anders Carlsson <andersca@codefactory.se>
+
* dbus/dbus-errors.c: (dbus_result_to_string), (dbus_error_init),
(dbus_error_free), (dbus_set_error_const), (dbus_set_error):
* dbus/dbus-errors.h:
loop.c \
loop.h \
services.c \
- services.h
+ services.h \
+ utils.c \
+ utils.h
+
libdbus_daemon_la_LIBADD= \
$(top_builddir)/dbus/libdbus-convenience.la
bus_connection_foreach (BusConnectionForeachFunction function,
void *data)
{
- _dbus_list_foreach (&connections, function, data);
+ _dbus_list_foreach (&connections, (DBusForeachFunction)function, data);
}
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-internals.h>
#include "desktop-file.h"
-
-typedef enum
-{
- BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX,
- BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES,
- BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS
-} BusDesktopParseError;
+#include "utils.h"
typedef struct
{
0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 ,
};
-static void report_error (BusDesktopFileParser *parser,
- char *message,
- BusDesktopParseError error_code,
- DBusResultCode *result);
+static void report_error (BusDesktopFileParser *parser,
+ char *message,
+ const char *error_name,
+ DBusError *error);
static void
parser_free (BusDesktopFileParser *parser)
else
new_n_lines = section->n_allocated_lines*2;
- _DBUS_HANDLE_OOM (lines = dbus_realloc (section->lines,
- sizeof (BusDesktopFileLine) * new_n_lines));
+ BUS_HANDLE_OOM (lines = dbus_realloc (section->lines,
+ sizeof (BusDesktopFileLine) * new_n_lines));
section->lines = lines;
section->n_allocated_lines = new_n_lines;
else
new_n_sections = desktop_file->n_allocated_sections*2;
- _DBUS_HANDLE_OOM (sections = dbus_realloc (desktop_file->sections,
- sizeof (BusDesktopFileSection) * new_n_sections));
+ BUS_HANDLE_OOM (sections = dbus_realloc (desktop_file->sections,
+ sizeof (BusDesktopFileSection) * new_n_sections));
desktop_file->sections = sections;
desktop_file->n_allocated_sections = new_n_sections;
/* len + 1 is enough, because unescaping never makes the
* string longer */
- _DBUS_HANDLE_OOM (retval = dbus_malloc (end_pos - pos + 1));
+ BUS_HANDLE_OOM (retval = dbus_malloc (end_pos - pos + 1));
q = retval;
n = desktop_file->n_sections++;
- _DBUS_HANDLE_OOM (desktop_file->sections[n].section_name = _dbus_strdup (name));
+ BUS_HANDLE_OOM (desktop_file->sections[n].section_name = _dbus_strdup (name));
desktop_file->sections[n].n_lines = 0;
desktop_file->sections[n].lines = NULL;
}
static dbus_bool_t
-parse_section_start (BusDesktopFileParser *parser, DBusResultCode *result)
+parse_section_start (BusDesktopFileParser *parser, DBusError *error)
{
int line_end;
char *section_name;
if (line_end - parser->pos <= 2 ||
_dbus_string_get_byte (&parser->data, line_end - 1) != ']')
{
- report_error (parser, "Invalid syntax for section header", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, result);
+ report_error (parser, "Invalid syntax for section header", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, error);
parser_free (parser);
return FALSE;
}
if (section_name == NULL)
{
- report_error (parser, "Invalid escaping in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES, result);
+ report_error (parser, "Invalid escaping in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES, error);
parser_free (parser);
return FALSE;
}
if (!is_valid_section_name (section_name))
{
- report_error (parser, "Invalid characters in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, result);
+ report_error (parser, "Invalid characters in section name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, error);
parser_free (parser);
dbus_free (section_name);
return FALSE;
}
static dbus_bool_t
-parse_key_value (BusDesktopFileParser *parser, DBusResultCode *result)
+parse_key_value (BusDesktopFileParser *parser, DBusError *error)
{
int line_end;
int key_start, key_end;
if (key_start == key_end)
{
- report_error (parser, "Empty key name", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, result);
+ report_error (parser, "Empty key name", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, error);
parser_free (parser);
return FALSE;
}
if (p < line_end && _dbus_string_get_byte (&parser->data, p) != '=')
{
- report_error (parser, "Invalid characters in key name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, result);
+ report_error (parser, "Invalid characters in key name", BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS, error);
parser_free (parser);
return FALSE;
}
if (p == line_end)
{
- report_error (parser, "No '=' in key/value pair", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, result);
+ report_error (parser, "No '=' in key/value pair", BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX, error);
parser_free (parser);
return FALSE;
}
value = unescape_string (&parser->data, value_start, line_end);
if (value == NULL)
{
- report_error (parser, "Invalid escaping in value", BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES, result);
+ report_error (parser, "Invalid escaping in value", BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES, error);
parser_free (parser);
return FALSE;
}
line = new_line (parser);
- _DBUS_HANDLE_OOM (_dbus_string_init (&key, key_end - key_start));
- _DBUS_HANDLE_OOM (_dbus_string_copy_len (&parser->data, key_start, key_end - key_start,
- &key, 0));
- _DBUS_HANDLE_OOM (_dbus_string_steal_data (&key, &tmp));
+ BUS_HANDLE_OOM (_dbus_string_init (&key, key_end - key_start));
+ BUS_HANDLE_OOM (_dbus_string_copy_len (&parser->data, key_start, key_end - key_start,
+ &key, 0));
+ BUS_HANDLE_OOM (_dbus_string_steal_data (&key, &tmp));
_dbus_string_free (&key);
line->key = tmp;
}
static void
-report_error (BusDesktopFileParser *parser,
- char *message,
- BusDesktopParseError error_code,
- DBusResultCode *result)
+report_error (BusDesktopFileParser *parser,
+ char *message,
+ const char *error_name,
+ DBusError *error)
{
const char *section_name = NULL;
section_name = parser->desktop_file->sections[parser->current_section].section_name;
if (section_name)
- _dbus_verbose ("Error in section %s at line %d: %s\n", section_name, parser->line_num, message);
+ BUS_HANDLE_OOM (dbus_set_error (error, error_name,
+ "Error in section %s at line %d: %s\n", section_name, parser->line_num, message));
else
- _dbus_verbose ("Error at line %d: %s\n", parser->line_num, message);
-
- dbus_set_result (result, DBUS_RESULT_FAILED);
+ BUS_HANDLE_OOM (dbus_set_error (error, error_name,
+ "Error at line %d: %s\n", parser->line_num, message));
}
#if 0
#endif
BusDesktopFile *
-bus_desktop_file_load (DBusString *filename,
- DBusResultCode *result)
+bus_desktop_file_load (DBusString *filename,
+ DBusError *error)
{
DBusString str;
DBusResultCode result_code;
/* FIXME: Check file size so we don't try to load a ridicously large file. */
- _DBUS_HANDLE_OOM (_dbus_string_init (&str, _DBUS_INT_MAX));
+ BUS_HANDLE_OOM (_dbus_string_init (&str, _DBUS_INT_MAX));
+
+ BUS_HANDLE_OOM ((result_code = _dbus_file_get_contents (&str, filename)) !=
+ DBUS_RESULT_NO_MEMORY);
- _DBUS_HANDLE_OOM ((result_code = _dbus_file_get_contents (&str, filename)) !=
- DBUS_RESULT_NO_MEMORY);
-
if (result_code != DBUS_RESULT_SUCCESS)
{
_dbus_string_free (&str);
- dbus_set_result (result, result_code);
+
+ /* FIXME: Set error */
return NULL;
}
{
_dbus_string_free (&str);
- /* FIXME: Use a better error code */
- dbus_set_result (result, DBUS_RESULT_FAILED);
+ /* FIXME: Set error */
return NULL;
}
- _DBUS_HANDLE_OOM (parser.desktop_file = dbus_malloc0 (sizeof (BusDesktopFile)));
+ BUS_HANDLE_OOM (parser.desktop_file = dbus_malloc0 (sizeof (BusDesktopFile)));
parser.data = str;
parser.line_num = 1;
{
if (_dbus_string_get_byte (&parser.data, parser.pos) == '[')
{
- if (!parse_section_start (&parser, result))
+ if (!parse_section_start (&parser, error))
return NULL;
}
else if (is_blank_line (&parser) ||
parse_comment_or_blank (&parser);
else
{
- if (!parse_key_value (&parser, result))
+ if (!parse_key_value (&parser, error))
return NULL;
}
}
_dbus_string_free (&parser.data);
- dbus_set_result (result, DBUS_RESULT_SUCCESS);
-
return parser.desktop_file;
}
if (!bus_desktop_file_get_raw (desktop_file, section, keyname, &raw))
return FALSE;
- _DBUS_HANDLE_OOM (*val = _dbus_strdup (raw));
+ BUS_HANDLE_OOM (*val = _dbus_strdup (raw));
return TRUE;
}
#include <dbus/dbus.h>
#include <dbus/dbus-string.h>
+#define BUS_DESKTOP_PARSE_ERROR_INVALID_SYNTAX "org.freedesktop.DBus.DesktopParseError.InvalidSyntax"
+#define BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES "org.freedesktop.DBus.DesktopParseError.InvalidEscapes"
+#define BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS "org.freedesktop.DBus.DesktopParseError.InvalidChars"
+
typedef struct BusDesktopFile BusDesktopFile;
BusDesktopFile *bus_desktop_file_load (DBusString *filename,
- DBusResultCode *result);
+ DBusError *error);
void bus_desktop_file_free (BusDesktopFile *file);
dbus_bool_t bus_desktop_file_get_raw (BusDesktopFile *desktop_file,
#include "dispatch.h"
#include "connection.h"
#include "driver.h"
+#include "utils.h"
#include <dbus/dbus-internals.h>
#include <string.h>
static void
send_one_message (DBusConnection *connection, void *data)
{
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, data, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, data, NULL, NULL));
}
void
/* Assign a sender to the message */
sender = bus_connection_get_name (connection);
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message, sender));
+ BUS_HANDLE_OOM (dbus_message_set_sender (message, sender));
service_name = dbus_message_get_service (message);
_dbus_assert (bus_service_get_primary_owner (service) != NULL);
/* Dispatch the message */
- _DBUS_HANDLE_OOM (dbus_connection_send_message (bus_service_get_primary_owner (service),
- message, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (bus_service_get_primary_owner (service),
+ message, NULL, NULL));
}
return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
#include "driver.h"
#include "dispatch.h"
#include "services.h"
+#include "utils.h"
#include <dbus/dbus-string.h>
#include <dbus/dbus-internals.h>
#include <string.h>
_dbus_verbose ("sending service deleted: %s\n", service_name);
- _DBUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
- DBUS_MESSAGE_SERVICE_DELETED));
+ BUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
+ DBUS_MESSAGE_SERVICE_DELETED));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
+ BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (message,
- DBUS_TYPE_STRING, service_name,
- 0));
+ BUS_HANDLE_OOM (dbus_message_append_fields (message,
+ DBUS_TYPE_STRING, service_name,
+ 0));
bus_dispatch_broadcast_message (message);
dbus_message_unref (message);
}
{
DBusMessage *message;
- _DBUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
- DBUS_MESSAGE_SERVICE_CREATED));
+ BUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
+ DBUS_MESSAGE_SERVICE_CREATED));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
-
- _DBUS_HANDLE_OOM (dbus_message_append_fields (message,
- DBUS_TYPE_STRING, service_name,
- 0));
+ BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
+
+ BUS_HANDLE_OOM (dbus_message_append_fields (message,
+ DBUS_TYPE_STRING, service_name,
+ 0));
bus_dispatch_broadcast_message (message);
dbus_message_unref (message);
}
{
DBusMessage *message;
- _DBUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
- DBUS_MESSAGE_SERVICE_LOST));
+ BUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
+ DBUS_MESSAGE_SERVICE_LOST));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (message,
- DBUS_TYPE_STRING, service_name,
- 0));
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
+ BUS_HANDLE_OOM (dbus_message_append_fields (message,
+ DBUS_TYPE_STRING, service_name,
+ 0));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL));
dbus_message_unref (message);
}
{
DBusMessage *message;
- _DBUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
- DBUS_MESSAGE_SERVICE_ACQUIRED));
+ BUS_HANDLE_OOM (message = dbus_message_new (DBUS_SERVICE_BROADCAST,
+ DBUS_MESSAGE_SERVICE_ACQUIRED));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (message,
- DBUS_TYPE_STRING, service_name,
- 0));
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_message_set_sender (message, DBUS_SERVICE_DBUS));
+ BUS_HANDLE_OOM (dbus_message_append_fields (message,
+ DBUS_TYPE_STRING, service_name,
+ 0));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, message, NULL, NULL));
dbus_message_unref (message);
}
DBusString unique_name;
BusService *service;
- _DBUS_HANDLE_OOM (_dbus_string_init (&unique_name, _DBUS_INT_MAX));
- _DBUS_HANDLE_OOM (create_unique_client_name (&unique_name));
+ BUS_HANDLE_OOM (_dbus_string_init (&unique_name, _DBUS_INT_MAX));
+ BUS_HANDLE_OOM (create_unique_client_name (&unique_name));
/* Create the service */
- _DBUS_HANDLE_OOM (service = bus_service_lookup (&unique_name, TRUE));
+ BUS_HANDLE_OOM (service = bus_service_lookup (&unique_name, TRUE));
bus_service_set_prohibit_replacement (service, TRUE);
/* Add the connection as the owner */
- _DBUS_HANDLE_OOM (bus_service_add_owner (service, connection));
- _DBUS_HANDLE_OOM (bus_connection_set_name (connection, &unique_name));
+ BUS_HANDLE_OOM (bus_service_add_owner (service, connection));
+ BUS_HANDLE_OOM (bus_connection_set_name (connection, &unique_name));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (message,
+ BUS_HANDLE_OOM (dbus_message_set_sender (message,
bus_connection_get_name (connection)));
_dbus_string_free (&unique_name);
- _DBUS_HANDLE_OOM (bus_driver_send_welcome_message (connection, message));
+ BUS_HANDLE_OOM (bus_driver_send_welcome_message (connection, message));
/* Broadcast a service created message */
bus_driver_send_service_created (bus_service_get_name (service));
name = bus_connection_get_name (connection);
_dbus_assert (name != NULL);
- _DBUS_HANDLE_OOM (welcome = dbus_message_new_reply (hello_message));
+ BUS_HANDLE_OOM (welcome = dbus_message_new_reply (hello_message));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (welcome, DBUS_SERVICE_DBUS));
+ BUS_HANDLE_OOM (dbus_message_set_sender (welcome, DBUS_SERVICE_DBUS));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (welcome,
+ BUS_HANDLE_OOM (dbus_message_append_fields (welcome,
DBUS_TYPE_STRING, name,
NULL));
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, welcome, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, welcome, NULL, NULL));
dbus_message_unref (welcome);
}
int len, i;
char **services;
- _DBUS_HANDLE_OOM (reply = dbus_message_new_reply (message));
+ BUS_HANDLE_OOM (reply = dbus_message_new_reply (message));
- _DBUS_HANDLE_OOM (services = bus_services_list (&len));
+ BUS_HANDLE_OOM (services = bus_services_list (&len));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (reply,
+ BUS_HANDLE_OOM (dbus_message_append_fields (reply,
DBUS_TYPE_STRING_ARRAY, services, len,
0));
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
dbus_message_unref (reply);
int service_reply;
int flags;
- _DBUS_HANDLE_OOM ((result = dbus_message_get_fields (message,
+ BUS_HANDLE_OOM ((result = dbus_message_get_fields (message,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_UINT32, &flags,
0)) != DBUS_RESULT_NO_MEMORY);
_dbus_string_init_const (&service_name, name);
service = bus_service_lookup (&service_name, TRUE);
- _DBUS_HANDLE_OOM ((reply = dbus_message_new_reply (message)));
+ BUS_HANDLE_OOM ((reply = dbus_message_new_reply (message)));
/*
* Check if the service already has an owner
{
/* Queue the connection */
- _DBUS_HANDLE_OOM (bus_service_add_owner (service, connection));
+ BUS_HANDLE_OOM (bus_service_add_owner (service, connection));
service_reply = DBUS_SERVICE_REPLY_IN_QUEUE;
}
* that will cause ServiceAcquired and ServiceLost messages to
* be sent.
*/
- _DBUS_HANDLE_OOM (bus_service_add_owner (service, connection));
+ BUS_HANDLE_OOM (bus_service_add_owner (service, connection));
bus_service_remove_owner (service, owner);
_dbus_assert (connection == bus_service_get_primary_owner (service));
service_reply = DBUS_SERVICE_REPLY_PRIMARY_OWNER;
/* Broadcast service created message */
bus_driver_send_service_created (bus_service_get_name (service));
- _DBUS_HANDLE_OOM (bus_service_add_owner (service, connection));
+ BUS_HANDLE_OOM (bus_service_add_owner (service, connection));
service_reply = DBUS_SERVICE_REPLY_PRIMARY_OWNER;
}
- _DBUS_HANDLE_OOM (dbus_message_append_fields (reply, DBUS_TYPE_UINT32, service_reply, 0));
+ BUS_HANDLE_OOM (dbus_message_append_fields (reply, DBUS_TYPE_UINT32, service_reply, 0));
/* Send service reply */
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
dbus_free (name);
dbus_message_unref (reply);
}
BusService *service;
char *name;
- _DBUS_HANDLE_OOM ((result = dbus_message_get_fields (message,
+ BUS_HANDLE_OOM ((result = dbus_message_get_fields (message,
DBUS_TYPE_STRING, &name,
0)) != DBUS_RESULT_NO_MEMORY);
if (result != DBUS_RESULT_SUCCESS)
_dbus_string_init_const (&service_name, name);
service = bus_service_lookup (&service_name, FALSE);
- _DBUS_HANDLE_OOM ((reply = dbus_message_new_reply (message)));
- _DBUS_HANDLE_OOM (dbus_message_set_sender (reply, DBUS_SERVICE_DBUS));
+ BUS_HANDLE_OOM ((reply = dbus_message_new_reply (message)));
+ BUS_HANDLE_OOM (dbus_message_set_sender (reply, DBUS_SERVICE_DBUS));
- _DBUS_HANDLE_OOM (dbus_message_append_fields (reply,
+ BUS_HANDLE_OOM (dbus_message_append_fields (reply,
DBUS_TYPE_UINT32, service != NULL,
0));
- _DBUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
+ BUS_HANDLE_OOM (dbus_connection_send_message (connection, reply, NULL, NULL));
dbus_message_unref (reply);
dbus_free (name);
}
*/
#include "loop.h"
+#include "utils.h"
#include <dbus/dbus-list.h>
#include <dbus/dbus-sysdeps.h>
watch, function, data);
}
-static void
-wait_for_memory (void)
-{
- _dbus_sleep_milliseconds (500);
-}
-
void
bus_loop_run (void)
{
fds = dbus_new0 (DBusPollFD, n_fds);
while (fds == NULL)
{
- wait_for_memory ();
+ bus_wait_for_memory ();
fds = dbus_new0 (DBusPollFD, n_fds);
}
watches_for_fds = dbus_new (WatchCallback*, n_fds);
while (watches_for_fds == NULL)
{
- wait_for_memory ();
+ bus_wait_for_memory ();
watches_for_fds = dbus_new (WatchCallback*, n_fds);
}
*
*/
#include "loop.h"
+#include "activation.h"
#include "connection.h"
#include "driver.h"
#include <dbus/dbus-list.h>
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* utils.c General utility functions
+ *
+ * Copyright (C) 2003 CodeFactory AB
+ * Copyright (C) 2003 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 1.2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "utils.h"
+#include <dbus/dbus-sysdeps.h>
+
+void
+bus_wait_for_memory (void)
+{
+ _dbus_sleep_milliseconds (500);
+}
+
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu" -*- */
+/* utils.h General utility functions
+ *
+ * Copyright (C) 2003 CodeFactory AB
+ * Copyright (C) 2003 Red Hat, Inc.
+ *
+ * Licensed under the Academic Free License version 1.2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef BUS_UTILS_H
+#define BUS_UTILS_H
+
+#define BUS_HANDLE_OOM(stat) (stat)
+
+void bus_wait_for_memory (void);
+
+#endif /* BUS_ACTIVATION_H */
#define _DBUS_STRUCT_OFFSET(struct_type, member) \
((long) ((unsigned char*) &((struct_type*) 0)->member))
-#define _DBUS_HANDLE_OOM(stat) (stat)
-
/* This alignment thing is from ORBit2 */
/* Align a value upward to a boundary, expressed as a number of bytes.
* E.g. align to an 8-byte boundary with argument of 8.