mirror of
https://github.com/fscotto/fsnap.git
synced 2026-11-26 11:19:52 +00:00
Fix naming inconsistencies: header guard, FieldName prefix, Operation typedef
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#ifndef TYPE_H
|
#ifndef TYPES_H
|
||||||
#define TYPE_H
|
#define TYPES_H
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -19,7 +19,7 @@ enum Fields {
|
|||||||
|
|
||||||
extern enum Fields field;
|
extern enum Fields field;
|
||||||
|
|
||||||
const char *FieldName(enum Fields f);
|
const char *RecordObjectFieldName(enum Fields f);
|
||||||
|
|
||||||
struct RecordObject;
|
struct RecordObject;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#ifndef WALK_H
|
#ifndef WALK_H
|
||||||
#define WALK_H
|
#define WALK_H
|
||||||
|
|
||||||
typedef int(*operation)(const char *, void *);
|
typedef int(*WalkOp)(const char *, void *);
|
||||||
|
|
||||||
int walk(const char *directory, operation op, void *context);
|
int walk(const char *directory, WalkOp op, void *context);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ int list(const char *snapshot) {
|
|||||||
}
|
}
|
||||||
int ret = RecordObjectUnpack(objp, buf);
|
int ret = RecordObjectUnpack(objp, buf);
|
||||||
if (field != NONE) {
|
if (field != NONE) {
|
||||||
fprintf(stderr, "%s:%d: invalid %s\n", snapshot, i + 1, FieldName(field));
|
fprintf(stderr, "%s:%d: invalid %s\n", snapshot, i + 1, RecordObjectFieldName(field));
|
||||||
rc = 128;
|
rc = 128;
|
||||||
RecordObjectRelease(objp);
|
RecordObjectRelease(objp);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ static const char *field_names[] = {
|
|||||||
"file type", "permissions", "uid", "gid", "size",
|
"file type", "permissions", "uid", "gid", "size",
|
||||||
"time", "target", "fingerprint", "path", "none"};
|
"time", "target", "fingerprint", "path", "none"};
|
||||||
|
|
||||||
const char *FieldName(enum Fields f) {
|
const char *RecordObjectFieldName(enum Fields f) {
|
||||||
return (f <= NONE) ? field_names[f] : "unknown";
|
return (f <= NONE) ? field_names[f] : "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ static int ignore_file(const char *name) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_unknown(const char *path, operation op, void *context) {
|
static int handle_unknown(const char *path, WalkOp op, void *context) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (lstat(path, &st) == -1) {
|
if (lstat(path, &st) == -1) {
|
||||||
@@ -36,7 +36,7 @@ static int handle_unknown(const char *path, operation op, void *context) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int walk(const char *directory, operation op, void *context) {
|
int walk(const char *directory, WalkOp op, void *context) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
DIR *dirp = opendir(directory);
|
DIR *dirp = opendir(directory);
|
||||||
if (dirp == NULL) {
|
if (dirp == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user