aboutsummaryrefslogtreecommitdiff
path: root/src/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/format.c b/src/format.c
index 8f42c00..49d5d35 100644
--- a/src/format.c
+++ b/src/format.c
@@ -87,9 +87,10 @@ next:
return true;
}
-bool format_remark(format_t *format, const char *label, const format_pair_t *pairs)
+int format_remark(format_t *format, const char *label, const format_pair_t *pairs)
{
- int errors = 0;
+ int errors = 0, marked = 0;
+
for (size_t i = 0; i < format->length; i++) {
// Skip regular strings
if (!format->marks[i]) continue;
@@ -103,6 +104,7 @@ bool format_remark(format_t *format, const char *label, const format_pair_t *pai
!strcmp(pairs[j].key, format->parts[i]))
{
format->marks[i] = pairs[j].mark;
+ marked++;
goto next;
}
}
@@ -113,7 +115,7 @@ bool format_remark(format_t *format, const char *label, const format_pair_t *pai
next:
}
- return errors == 0;
+ return errors > 0 ? -errors : marked;
}
void format_free(format_t *format)