summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-21 02:11:06 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-21 02:11:06 +0100
commit14c24659cdc98e26049b98b965382a0c44eae008 (patch)
tree91c016bb26876391016c36c1f36111df0cbf4b9f /src
parentdf2d202e6ed4001a21c6512c244acad5d4706c87 (diff)
bus: rename SD_BUS_ERROR_MAKE to SD_BUS_ERROR_MAKE_CONST to indicate it only works for const strings
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-error.c32
-rw-r--r--src/libsystemd-bus/sd-bus.c4
-rw-r--r--src/libsystemd-bus/test-bus-chat.c2
-rw-r--r--src/libsystemd-bus/test-bus-server.c2
-rw-r--r--src/systemd/sd-bus.h4
5 files changed, 22 insertions, 22 deletions
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c
index 652d8e2e70..7fef681413 100644
--- a/src/libsystemd-bus/bus-error.c
+++ b/src/libsystemd-bus/bus-error.c
@@ -157,7 +157,7 @@ _public_ int sd_bus_error_set_const(sd_bus_error *e, const char *name, const cha
assert_return(!bus_error_is_dirty(e), -EINVAL);
assert_return(name, -EINVAL);
- *e = SD_BUS_ERROR_MAKE(name, message);
+ *e = SD_BUS_ERROR_MAKE_CONST(name, message);
return sd_bus_error_get_errno(e);
}
@@ -331,53 +331,53 @@ static sd_bus_error map_from_errno(int error) {
switch (error) {
case ENOMEM:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_NO_NETWORK, "Out of memory");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NO_NETWORK, "Out of memory");
case EPERM:
case EACCES:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_ACCESS_DENIED, "Access denied");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_ACCESS_DENIED, "Access denied");
case EINVAL:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_INVALID_ARGS, "Invalid argument");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_INVALID_ARGS, "Invalid argument");
case ESRCH:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, "No such process");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, "No such process");
case ENOENT:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_FILE_NOT_FOUND, "File not found");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_FILE_NOT_FOUND, "File not found");
case EEXIST:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_FILE_EXISTS, "File exists");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_FILE_EXISTS, "File exists");
case ETIMEDOUT:
case ETIME:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_TIMEOUT, "Timed out");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_TIMEOUT, "Timed out");
case EIO:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_IO_ERROR, "Input/output error");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_IO_ERROR, "Input/output error");
case ENETRESET:
case ECONNABORTED:
case ECONNRESET:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_DISCONNECTED, "Disconnected");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_DISCONNECTED, "Disconnected");
case ENOTSUP:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_NOT_SUPPORTED, "Not supported");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NOT_SUPPORTED, "Not supported");
case EADDRNOTAVAIL:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_BAD_ADDRESS, "Address not available");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_BAD_ADDRESS, "Address not available");
case ENOBUFS:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_LIMITS_EXCEEDED, "Limits exceeded");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_LIMITS_EXCEEDED, "Limits exceeded");
case EADDRINUSE:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_ADDRESS_IN_USE, "Address in use");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_ADDRESS_IN_USE, "Address in use");
case EBADMSG:
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_INCONSISTENT_MESSAGE, "Inconsistent message");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_INCONSISTENT_MESSAGE, "Inconsistent message");
}
- return SD_BUS_ERROR_MAKE(SD_BUS_ERROR_FAILED, "Operation failed");
+ return SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_FAILED, "Operation failed");
}
_public_ int sd_bus_error_set_errno(sd_bus_error *e, int error) {
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 9374be93ca..7f00eee6e1 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -1842,7 +1842,7 @@ static int process_timeout(sd_bus *bus) {
r = bus_message_new_synthetic_error(
bus,
c->serial,
- &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_NO_REPLY, "Method call timed out"),
+ &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NO_REPLY, "Method call timed out"),
&m);
if (r < 0)
return r;
@@ -2127,7 +2127,7 @@ static int process_closing(sd_bus *bus, sd_bus_message **ret) {
r = bus_message_new_synthetic_error(
bus,
c->serial,
- &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_NO_REPLY, "Connection terminated"),
+ &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_NO_REPLY, "Connection terminated"),
&m);
if (r < 0)
return r;
diff --git a/src/libsystemd-bus/test-bus-chat.c b/src/libsystemd-bus/test-bus-chat.c
index 8c344f6edb..0c66dc794a 100644
--- a/src/libsystemd-bus/test-bus-chat.c
+++ b/src/libsystemd-bus/test-bus-chat.c
@@ -246,7 +246,7 @@ static int server(sd_bus *bus) {
r = sd_bus_reply_method_error(
m,
- &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."));
+ &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."));
if (r < 0) {
log_error("Failed to send reply: %s", strerror(-r));
goto fail;
diff --git a/src/libsystemd-bus/test-bus-server.c b/src/libsystemd-bus/test-bus-server.c
index 33a5dd5f6f..0e65ee782a 100644
--- a/src/libsystemd-bus/test-bus-server.c
+++ b/src/libsystemd-bus/test-bus-server.c
@@ -99,7 +99,7 @@ static void *server(void *p) {
} else if (sd_bus_message_is_method_call(m, NULL, NULL)) {
r = sd_bus_message_new_method_error(
m,
- &SD_BUS_ERROR_MAKE(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."),
+ &SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."),
&reply);
if (r < 0) {
log_error("Failed to allocate return: %s", strerror(-r));
diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h
index 6537a77164..9693f4bac6 100644
--- a/src/systemd/sd-bus.h
+++ b/src/systemd/sd-bus.h
@@ -256,8 +256,8 @@ int sd_bus_get_owner_machine_id(sd_bus *bus, const char *name, sd_id128_t *machi
/* Error structures */
-#define SD_BUS_ERROR_MAKE(name, message) ((sd_bus_error) {(name), (message), 0})
-#define SD_BUS_ERROR_NULL SD_BUS_ERROR_MAKE(NULL, NULL)
+#define SD_BUS_ERROR_MAKE_CONST(name, message) ((sd_bus_error) {(name), (message), 0})
+#define SD_BUS_ERROR_NULL SD_BUS_ERROR_MAKE_CONST(NULL, NULL)
void sd_bus_error_free(sd_bus_error *e);
int sd_bus_error_set(sd_bus_error *e, const char *name, const char *message);