Dietrich Epp 3bf095fb49 Make source file headers consistent
- Standardize copyright and license notice
- Standardize header guards
2022-04-10 04:22:58 -04:00

49 lines
1.2 KiB

// Copyright 2022 Dietrich Epp.
// This file is part of SyncFiles. SyncFiles is licensed under the terms of the
// Mozilla Public License, version 2.0. See LICENSE.txt for details.
#ifndef SYNC_TREE_H
#define SYNC_TREE_H
/* tree.h - binary search trees of file metadata */
#include "sync/meta.h"
/* A reference to a file node by 1-based index, or 0 for none. */
typedef int FileRef;
typedef enum {
} NodeColor;
/* A file record stored in a binary search tree. */
struct FileNode {
/* The sort key. This is a case-folded version of the local filename. */
FileName key;
struct FileRec file;
/* The root of the tree for the directory contents, if this is a
directory. */
FileRef directory_root;
/* Binary search tree bookkeeping. */
NodeColor color;
FileRef children[2];
/* Binary search tree of files. */
struct FileTree {
struct FileNode **nodes;
Size count;
Size alloc;
FileRef root;
/* Insert a node into the tree with the given key. On success, return a positive
FileRef. On failure, return a negative error code. To get the error code
value, negate the function result. */
FileRef TreeInsert(struct FileTree *tree, FileRef directory,
const FileName *key);