Extract snapshot parser into a reusable types module

Splits RecordObject, unpack, release, field and field_name out of list.c into types.c/types.h; declares field extern in the header with a single definition in types.c; adds src/types.c to SOURCES.
This commit is contained in:
Fabio Scotto di Santolo
2026-08-21 00:00:23 +02:00
parent 3d63af4202
commit 9df9223b63
5 changed files with 281 additions and 265 deletions

View File

@@ -1,10 +1,6 @@
#ifndef LIST_H
#define LIST_H
struct RecordObject;
struct RecordObject *unpack(char *s);
int release(struct RecordObject *obj);
int list(const char *snapshot);
#endif

23
include/types.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef TYPE_H
#define TYPE_H
enum Fields {
FILE_TYPE,
PERMISSIONS,
UID,
GID,
SIZE,
TIME,
PATH,
NONE,
};
extern enum Fields field;
const char *field_name(enum Fields f);
struct RecordObject;
struct RecordObject *unpack(char *s);
int release(struct RecordObject *obj);
#endif