summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.c14
-rw-r--r--content/content_protected.h2
2 files changed, 14 insertions, 2 deletions
diff --git a/content/content.c b/content/content.c
index ed5202009..f792e794a 100644
--- a/content/content.c
+++ b/content/content.c
@@ -280,8 +280,7 @@ void content_convert(struct content *c)
if (c->handler->data_complete != NULL) {
c->locked = true;
if (c->handler->data_complete(c) == false) {
- c->locked = false;
- c->status = CONTENT_STATUS_ERROR;
+ content_set_error(c);
}
/* Conversion to the READY state will unlock the content */
} else {
@@ -322,6 +321,17 @@ void content_set_done(struct content *c)
content_broadcast(c, CONTENT_MSG_DONE, msg_data);
}
+/**
+ * Put a content in status CONTENT_STATUS_ERROR and unlock the content.
+ *
+ * \note We expect the caller to broadcast an error report if needed.
+ */
+
+void content_set_error(struct content *c)
+{
+ c->locked = false;
+ c->status = CONTENT_STATUS_ERROR;
+}
/**
* Reformat to new size.
diff --git a/content/content_protected.h b/content/content_protected.h
index 4fe9b942a..d113508e4 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -148,6 +148,8 @@ nserror content__clone(const struct content *c, struct content *nc);
void content_set_ready(struct content *c);
void content_set_done(struct content *c);
+void content_set_error(struct content *c);
+
void content_set_status(struct content *c, const char *status_message, ...);
void content_broadcast(struct content *c, content_msg msg,
union content_msg_data data);