dbus/dbus dbus-sysdeps-unix.c, 1.24, 1.25 dbus-sysdeps-win.c, 1.8,
1.9 dbus-sysdeps.c, 1.121, 1.122 dbus-sysdeps.h, 1.72, 1.73
Ralf Habacker
rhabacker at kemper.freedesktop.org
Fri Mar 16 14:56:35 PDT 2007
- Previous message: dbus/bus config-parser.c, 1.48, 1.49 dbus-daemon.1.in, 1.7,
1.8 policy.c, 1.24, 1.25 policy.h, 1.17, 1.18 session.conf.in,
1.12, 1.13
- Next message: dbus ChangeLog,1.1265,1.1266
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv8471/dbus
Modified Files:
dbus-sysdeps-unix.c dbus-sysdeps-win.c dbus-sysdeps.c
dbus-sysdeps.h
Log Message:
* dbus/dbus-sysdeps.h (_dbus_split_paths_and_append): new prototyp (_DBUS_PATH_SEPARATOR): new macro.
* dbus/dbus-sysdeps.c (_dbus_split_paths_and_append): merged from dbus/dbus-sysdeps-unix.c and dbus/dbus-sysdeps-win.c.
Index: dbus-sysdeps-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-unix.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbus-sysdeps-unix.c 13 Mar 2007 17:14:35 -0000 1.24
+++ dbus-sysdeps-unix.c 16 Mar 2007 21:56:33 -0000 1.25
@@ -2695,120 +2695,6 @@
#define DBUS_UNIX_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
-static dbus_bool_t
-split_paths_and_append (DBusString *dirs,
- const char *suffix,
- DBusList **dir_list)
-{
- /* split on colon (:) */
- int start;
- int i;
- int len;
- char *cpath;
- const DBusString file_suffix;
-
- start = 0;
- i = 0;
-
- _dbus_string_init_const (&file_suffix, suffix);
-
- len = _dbus_string_get_length (dirs);
-
- while (_dbus_string_find (dirs, start, ":", &i))
- {
- DBusString path;
-
- if (!_dbus_string_init (&path))
- goto oom;
-
- if (!_dbus_string_copy_len (dirs,
- start,
- i - start,
- &path,
- 0))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- _dbus_string_chop_white (&path);
-
- /* check for an empty path */
- if (_dbus_string_get_length (&path) == 0)
- goto next;
-
- if (!_dbus_concat_dir_and_file (&path,
- &file_suffix))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_string_copy_data(&path, &cpath))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_list_append (dir_list, cpath))
- {
- _dbus_string_free (&path);
- dbus_free (cpath);
- goto oom;
- }
-
- next:
- _dbus_string_free (&path);
- start = i + 1;
- }
-
- if (start != len)
- {
- DBusString path;
-
- if (!_dbus_string_init (&path))
- goto oom;
-
- if (!_dbus_string_copy_len (dirs,
- start,
- len - start,
- &path,
- 0))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_concat_dir_and_file (&path,
- &file_suffix))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_string_copy_data(&path, &cpath))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_list_append (dir_list, cpath))
- {
- _dbus_string_free (&path);
- dbus_free (cpath);
- goto oom;
- }
-
- _dbus_string_free (&path);
- }
-
- return TRUE;
-
- oom:
- _dbus_list_foreach (dir_list, (DBusForeachFunction)dbus_free, NULL);
- _dbus_list_clear (dir_list);
- return FALSE;
-}
/**
* Returns the standard directories for a session bus to look for service
@@ -2884,9 +2770,9 @@
goto oom;
}
- if (!split_paths_and_append (&servicedir_path,
- DBUS_UNIX_STANDARD_SESSION_SERVICEDIR,
- dirs))
+ if (!_dbus_split_paths_and_append (&servicedir_path,
+ DBUS_UNIX_STANDARD_SESSION_SERVICEDIR,
+ dirs))
goto oom;
_dbus_string_free (&servicedir_path);
Index: dbus-sysdeps-win.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-win.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- dbus-sysdeps-win.c 13 Mar 2007 17:14:35 -0000 1.8
+++ dbus-sysdeps-win.c 16 Mar 2007 21:56:33 -0000 1.9
@@ -5048,125 +5048,6 @@
#define DBUS_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
-// @TODO: this function is duplicated from dbus-sysdeps-unix.c
-// and differs only in the path separator, may be we should
-// use a dbus path separator variable
-
-#define _dbus_path_seperator ";"
-
-static dbus_bool_t
-split_paths_and_append (DBusString *dirs,
- const char *suffix,
- DBusList **dir_list)
-{
- int start;
- int i;
- int len;
- char *cpath;
- const DBusString file_suffix;
-
- start = 0;
- i = 0;
-
- _dbus_string_init_const (&file_suffix, suffix);
-
- len = _dbus_string_get_length (dirs);
-
- while (_dbus_string_find (dirs, start, _dbus_path_seperator, &i))
- {
- DBusString path;
-
- if (!_dbus_string_init (&path))
- goto oom;
-
- if (!_dbus_string_copy_len (dirs,
- start,
- i - start,
- &path,
- 0))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- _dbus_string_chop_white (&path);
-
- /* check for an empty path */
- if (_dbus_string_get_length (&path) == 0)
- goto next;
-
- if (!_dbus_concat_dir_and_file (&path,
- &file_suffix))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_string_copy_data(&path, &cpath))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_list_append (dir_list, cpath))
- {
- _dbus_string_free (&path);
- dbus_free (cpath);
- goto oom;
- }
-
- next:
- _dbus_string_free (&path);
- start = i + 1;
- }
-
- if (start != len)
- {
- DBusString path;
-
- if (!_dbus_string_init (&path))
- goto oom;
-
- if (!_dbus_string_copy_len (dirs,
- start,
- len - start,
- &path,
- 0))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_concat_dir_and_file (&path,
- &file_suffix))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_string_copy_data(&path, &cpath))
- {
- _dbus_string_free (&path);
- goto oom;
- }
-
- if (!_dbus_list_append (dir_list, cpath))
- {
- _dbus_string_free (&path);
- dbus_free (cpath);
- goto oom;
- }
-
- _dbus_string_free (&path);
- }
-
- return TRUE;
-
- oom:
- _dbus_list_foreach (dir_list, (DBusForeachFunction)dbus_free, NULL);
- _dbus_list_clear (dir_list);
- return FALSE;
-}
/**
* Returns the standard directories for a session bus to look for service
@@ -5193,7 +5074,7 @@
if (!_dbus_string_init (&servicedir_path))
return FALSE;
- if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR";"))
+ if (!_dbus_string_append (&servicedir_path, DBUS_DATADIR _DBUS_PATH_SEPARATOR))
goto oom;
common_progs = _dbus_getenv ("CommonProgramFiles");
@@ -5203,11 +5084,11 @@
if (!_dbus_string_append (&servicedir_path, common_progs))
goto oom;
- if (!_dbus_string_append (&servicedir_path, ";"))
+ if (!_dbus_string_append (&servicedir_path, _DBUS_PATH_SEPARATOR))
goto oom;
}
- if (!split_paths_and_append (&servicedir_path,
+ if (!_dbus_split_paths_and_append (&servicedir_path,
DBUS_STANDARD_SESSION_SERVICEDIR,
dirs))
goto oom;
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- dbus-sysdeps.c 13 Mar 2007 17:14:35 -0000 1.121
+++ dbus-sysdeps.c 16 Mar 2007 21:56:33 -0000 1.122
@@ -27,6 +27,7 @@
#include "dbus-threads.h"
#include "dbus-protocol.h"
#include "dbus-string.h"
+#include "dbus-list.h"
/* NOTE: If you include any unix/windows-specific headers here, you are probably doing something
* wrong and should be putting some code in dbus-sysdeps-unix.c or dbus-sysdeps-win.c.
@@ -231,6 +232,127 @@
pipe->fd_or_handle = -1;
}
+/**
+ * split pathes into a list of char strings
+ * @param dirs string with pathes
+ * @param suffix string concated to each path in dirs
+ * @param dir_list contains a list of splitted pathes
+ * return #TRUE is pathes could be splittes,#FALSE in oom case
+ */
+dbus_bool_t
+_dbus_split_paths_and_append (DBusString *dirs,
+ const char *suffix,
+ DBusList **dir_list)
+{
+ int start;
+ int i;
+ int len;
+ char *cpath;
+ const DBusString file_suffix;
+
+ start = 0;
+ i = 0;
+
+ _dbus_string_init_const (&file_suffix, suffix);
+
+ len = _dbus_string_get_length (dirs);
+
+ while (_dbus_string_find (dirs, start, _DBUS_PATH_SEPARATOR, &i))
+ {
+ DBusString path;
+
+ if (!_dbus_string_init (&path))
+ goto oom;
+
+ if (!_dbus_string_copy_len (dirs,
+ start,
+ i - start,
+ &path,
+ 0))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ _dbus_string_chop_white (&path);
+
+ /* check for an empty path */
+ if (_dbus_string_get_length (&path) == 0)
+ goto next;
+
+ if (!_dbus_concat_dir_and_file (&path,
+ &file_suffix))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ if (!_dbus_string_copy_data(&path, &cpath))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ if (!_dbus_list_append (dir_list, cpath))
+ {
+ _dbus_string_free (&path);
+ dbus_free (cpath);
+ goto oom;
+ }
+
+ next:
+ _dbus_string_free (&path);
+ start = i + 1;
+ }
+
+ if (start != len)
+ {
+ DBusString path;
+
+ if (!_dbus_string_init (&path))
+ goto oom;
+
+ if (!_dbus_string_copy_len (dirs,
+ start,
+ len - start,
+ &path,
+ 0))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ if (!_dbus_concat_dir_and_file (&path,
+ &file_suffix))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ if (!_dbus_string_copy_data(&path, &cpath))
+ {
+ _dbus_string_free (&path);
+ goto oom;
+ }
+
+ if (!_dbus_list_append (dir_list, cpath))
+ {
+ _dbus_string_free (&path);
+ dbus_free (cpath);
+ goto oom;
+ }
+
+ _dbus_string_free (&path);
+ }
+
+ return TRUE;
+
+ oom:
+ _dbus_list_foreach (dir_list, (DBusForeachFunction)dbus_free, NULL);
+ _dbus_list_clear (dir_list);
+ return FALSE;
+}
+
/** @} */
/**
Index: dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- dbus-sysdeps.h 12 Mar 2007 22:52:40 -0000 1.72
+++ dbus-sysdeps.h 16 Mar 2007 21:56:33 -0000 1.73
@@ -41,6 +41,12 @@
DBUS_BEGIN_DECLS
+#ifdef DBUS_WIN
+#define _DBUS_PATH_SEPARATOR ";"
+#else
+#define _DBUS_PATH_SEPARATOR ":"
+#endif
+
/* Forward declarations */
/** An opaque string type */
@@ -462,6 +468,10 @@
*/
dbus_bool_t _dbus_threads_init_platform_specific (void);
+dbus_bool_t _dbus_split_paths_and_append (DBusString *dirs,
+ const char *suffix,
+ DBusList **dir_list);
+
/** @} */
DBUS_END_DECLS
- Previous message: dbus/bus config-parser.c, 1.48, 1.49 dbus-daemon.1.in, 1.7,
1.8 policy.c, 1.24, 1.25 policy.h, 1.17, 1.18 session.conf.in,
1.12, 1.13
- Next message: dbus ChangeLog,1.1265,1.1266
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list