mirror of
https://github.com/fscotto/fsnap.git
synced 2026-11-26 03:09:51 +00:00
Cosmetic cleanups across the tree
No behavioural change; verified byte-identical scan output over /usr/include and /etc and byte-identical snapshots against the previous build, with valgrind clean on every command. - free() accepts NULL, so drop six guards around it in types.c. - RecordObjectRelease returned an int no caller ever read; make it void, which is the idiom for a free-like function. - RecordObjectFieldName bounded its index only from above. The underlying type of an enum is the compiler's choice, so compare as unsigned and catch a negative value too. - copy() opened the destination "w+" but never reads it back; "w" says what it does. - Testing strlen(s) == 0 walks the whole string to answer a question about its first byte. - Two comments contradicted the code: split_record finds eight separators, not six, and strconcat explains itself in terms of a strcat it does not call. - Drop includes nothing uses: <inttypes.h> from list.c and create.c, and <string.h> from list.c and from scan.c, which stopped needing it once the strlen above was gone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018KyCHPAxWzqa3vHKdXJkgx
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
#include "types.h"
|
||||
#include "utility.h"
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int list(const char *snapshot) {
|
||||
FILE *snapshot_file = fopen(snapshot, "r");
|
||||
|
||||
Reference in New Issue
Block a user