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