1.1 --- a/librazor/razor-internal.h Sat Aug 23 16:07:09 2014 +0100
1.2 +++ b/librazor/razor-internal.h Fri Oct 17 09:57:19 2014 +0100
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Copyright (C) 2008 Kristian Høgsberg <krh@redhat.com>
1.6 * Copyright (C) 2008 Red Hat, Inc
1.7 - * Copyright (C) 2009, 2011-2012 J. Ali Harlow <ali@juiblex.co.uk>
1.8 + * Copyright (C) 2009, 2011-2012, 2014 J. Ali Harlow <ali@juiblex.co.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or modify
1.11 * it under the terms of the GNU General Public License as published by
1.12 @@ -247,24 +247,35 @@
1.13
1.14 /* Error functions */
1.15 struct razor_error {
1.16 - char *path;
1.17 + int domain;
1.18 + int code;
1.19 + char *object;
1.20 char *str;
1.21 - char *path_str;
1.22 + char *obj_str;
1.23 char *summary;
1.24 char *msg;
1.25 };
1.26
1.27 +#define razor_error_new_posix(object) \
1.28 + razor_error_new_str(RAZOR_POSIX_ERROR, errno, object, strerror(errno))
1.29 +#define razor_set_error_posix(error, object) \
1.30 + if (error) \
1.31 + *(error) = razor_error_new_posix(object); \
1.32 + else
1.33 +
1.34 #ifdef MSWIN_API
1.35 -struct razor_error *razor_error_new_mswin(const wchar_t *path, DWORD error);
1.36 -struct razor_error *razor_error_new_str2(const wchar_t *path, const char *str);
1.37 +struct razor_error *razor_error_new_mswin(const wchar_t *object, DWORD error);
1.38 +struct razor_error *razor_error_new_str2(int domain, int code,
1.39 + const wchar_t *object,
1.40 + const char *str);
1.41
1.42 -#define razor_set_error_mswin(error, path, err) \
1.43 +#define razor_set_error_mswin(error, object, err) \
1.44 if (error) \
1.45 - *(error) = razor_error_new_mswin(path, err); \
1.46 + *(error) = razor_error_new_mswin(object, err); \
1.47 else
1.48 -#define razor_set_error2(error, path, str) \
1.49 +#define razor_set_error2(error, domain, code, object, str) \
1.50 if (error) \
1.51 - *(error) = razor_error_new_str2(path, str); \
1.52 + *(error) = razor_error_new_str2(domain, code, object, str); \
1.53 else
1.54 #endif /* MSWIN_API */
1.55