c->index = c->saved_index;
}
-_public_ int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char **contents) {
+_public_ int sd_bus_message_peek_type(sd_bus_message *m, char *ret_type, const char **ret_contents) {
struct bus_container *c;
int r;
c = message_get_last_container(m);
if (bus_type_is_basic(c->signature[c->index])) {
- if (contents)
- *contents = NULL;
- if (type)
- *type = c->signature[c->index];
+ if (ret_contents)
+ *ret_contents = NULL;
+ if (ret_type)
+ *ret_type = c->signature[c->index];
return 1;
}
if (c->signature[c->index] == SD_BUS_TYPE_ARRAY) {
- if (contents) {
+ if (ret_contents) {
size_t l;
r = signature_element_length(c->signature+c->index+1, &l);
c->signature + c->index + 1, l) < 0)
return -ENOMEM;
- *contents = c->peeked_signature;
+ *ret_contents = c->peeked_signature;
}
- if (type)
- *type = SD_BUS_TYPE_ARRAY;
+ if (ret_type)
+ *ret_type = SD_BUS_TYPE_ARRAY;
return 1;
}
if (IN_SET(c->signature[c->index], SD_BUS_TYPE_STRUCT_BEGIN, SD_BUS_TYPE_DICT_ENTRY_BEGIN)) {
- if (contents) {
+ if (ret_contents) {
size_t l;
r = signature_element_length(c->signature+c->index, &l);
c->signature + c->index + 1, l - 2) < 0)
return -ENOMEM;
- *contents = c->peeked_signature;
+ *ret_contents = c->peeked_signature;
}
- if (type)
- *type = c->signature[c->index] == SD_BUS_TYPE_STRUCT_BEGIN ? SD_BUS_TYPE_STRUCT : SD_BUS_TYPE_DICT_ENTRY;
+ if (ret_type)
+ *ret_type = c->signature[c->index] == SD_BUS_TYPE_STRUCT_BEGIN ? SD_BUS_TYPE_STRUCT : SD_BUS_TYPE_DICT_ENTRY;
return 1;
}
if (c->signature[c->index] == SD_BUS_TYPE_VARIANT) {
- if (contents) {
+ if (ret_contents) {
size_t rindex, l;
void *q;
if (!validate_signature(q, l))
return -EBADMSG;
- *contents = q;
+ *ret_contents = q;
}
- if (type)
- *type = SD_BUS_TYPE_VARIANT;
+ if (ret_type)
+ *ret_type = SD_BUS_TYPE_VARIANT;
return 1;
}
return -EINVAL;
eof:
- if (type)
- *type = 0;
- if (contents)
- *contents = NULL;
+ if (ret_type)
+ *ret_type = 0;
+ if (ret_contents)
+ *ret_contents = NULL;
return 0;
}
int sd_bus_message_skip(sd_bus_message *m, const char *types);
int sd_bus_message_enter_container(sd_bus_message *m, char type, const char *contents);
int sd_bus_message_exit_container(sd_bus_message *m);
-int sd_bus_message_peek_type(sd_bus_message *m, char *type, const char **contents);
+int sd_bus_message_peek_type(sd_bus_message *m, char *ret_type, const char **ret_contents);
int sd_bus_message_verify_type(sd_bus_message *m, char type, const char *contents);
int sd_bus_message_at_end(sd_bus_message *m, int complete);
int sd_bus_message_rewind(sd_bus_message *m, int complete);