Name the parse-error status instead of repeating 128

The literal appeared in list.c and diff.c, was spelled out in prose in
both their headers, and collided with an unrelated 128 in
RecordObjectCompare, where it is an ordering sentinel for a NULL argument
rather than a status.

Introduce include/status.h with FSNAP_EPARSE, use it in both commands,
and say in types.h that the value there means something else.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
This commit is contained in:
Fabio Scotto di Santolo
2026-08-26 15:33:31 +02:00
parent e19378308d
commit cf7db11099
6 changed files with 26 additions and 7 deletions

View File

@@ -38,8 +38,10 @@ int RecordObjectUnpack(struct RecordObject *self, char *s, enum Fields *err);
int RecordObjectWrite(struct RecordObject *self, const char *path, FILE *out);
/* Compare two RecordObjects field by field.
Returns 0 if equal, a non-zero difference otherwise.
On NULL self returns 128, on NULL other returns 1.
Returns 0 if equal, and an ordering like strcmp otherwise: negative if self
sorts first, positive if other does. On NULL self returns 128 and on NULL
other 1; those are ordering sentinels, unrelated to the FSNAP_EPARSE command
status that happens to share the value.
If err is non-NULL, sets *err to the first differing field. */
int RecordObjectCompare(const struct RecordObject *self,
const struct RecordObject *other, enum Fields *err);