From 6b40feaff4114ab3498ad06e13063fceff4d48e9 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Thu, 20 Feb 2003 03:43:18 +0000 Subject: 2003-02-19 Havoc Pennington * Doxyfile.in (PREDEFINED): put DOXYGEN_SHOULD_SKIP_THIS in Doxyfile.in, not Doxyfile * dbus/dbus-keyring.c: do some hacking on this * dbus/dbus-sysdeps.c (_dbus_delete_file): new * dbus/dbus-errors.c (dbus_set_error_const): do not call dbus_error_init (dbus_set_error): remove dbus_error_init, check for message == NULL *before* we sprintf into it, and add @todo about including system headers in this file * dbus/dbus-sysdeps.c (_dbus_create_file_exclusively): new * dbus/dbus-errors.h (DBUS_ERROR_FAILED): add * dbus/dbus-sysdeps.c (get_user_info): break this function out to get various bits of user information based on either username or user ID (_dbus_homedir_from_username): new function --- dbus/dbus-errors.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'dbus/dbus-errors.c') diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index 92cca03c..a469f7e6 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -183,10 +183,6 @@ dbus_error_free (DBusError *error) * Assigns an error name and message to a DBusError. * Does nothing if error is #NULL. * - * @todo calling dbus_error_init() in here is no good, - * for the same reason a GError* has to be set to NULL - * before you pass it in. - * * @param error the error. * @param name the error name (not copied!!!) * @param message the error message (not copied!!!) @@ -200,8 +196,6 @@ dbus_set_error_const (DBusError *error, if (error == NULL) return; - - dbus_error_init (error); real = (DBusRealError *)error; @@ -216,6 +210,9 @@ dbus_set_error_const (DBusError *error, * * If no memory can be allocated for the error message, * an out-of-memory error message will be set instead. + * + * @todo stdio.h shouldn't be included in this file, + * should write _dbus_string_append_printf instead * * @param error the error. * @param name the error name (not copied!!!) @@ -237,16 +234,11 @@ dbus_set_error (DBusError *error, return; va_start (args, format); - /* Measure the message length */ - message_length = vsnprintf (&c, 1,format, args) + 1; - - message = dbus_malloc (message_length); - + message_length = vsnprintf (&c, 1, format, args) + 1; va_end (args); - va_start (args, format); - vsprintf (message, format, args2); + message = dbus_malloc (message_length); if (!message) { @@ -255,9 +247,10 @@ dbus_set_error (DBusError *error, return; } + va_start (args, format); + vsprintf (message, format, args2); va_end (args); - dbus_error_init (error); real = (DBusRealError *)error; real->name = name; -- cgit