dbus-sysdeps-unix.h

Peter Kümmel syntheticpp at gmx.net
Tue Sep 12 03:47:08 PDT 2006


Havoc Pennington wrote:
>> For the windows code it would be best to drop the indistinguishably
>> of the descriptors and to introduce types for each resource:
>> DBusFile, DBusSocket, DBusPipe, then with functions like
>> _dbus_open_file, _dbus_open_socket,... errors are caught at
>> compile time and we don't need to encode the descriptors with
>> the some type information.
> 
> Agreed, my other mail I just sent suggested something very similar.
> 

I've started with DBusFile, and have added to sysdeps.h:


typedef struct DBusFile DBusFile;

dbus_bool_t _dbus_open_file (DBusFile   *file,
                             const char *filename,
                             int         oflag,
                             int         pmode);

dbus_bool_t _dbus_close_file (DBusFile  *file,
                              DBusError *error);


int _dbus_read_file (DBusFile   *file,
                     DBusString *buffer,
                     int         count);


As intermidate step I've renamed _dbus_close to
_dbus_close_not_a_file, and fixed the rest of the code.


Now I have two questions:

On the Windows side I use

struct DBusFile {
    int d;
};

Should I use this type also for the unix code or
is a other way preferred?

And how should I prepare the patch, on patch for all
_file, _socket, _pipe renaming?


I think after the renaming we then could eventually
move some declarations, or rename some files.

Peter


More information about the dbus mailing list