Turn my disgusting readdir macros into a reasonably clean function
[sgt/agedu] / trie.h
diff --git a/trie.h b/trie.h
index 6d377b5..ef52a08 100644 (file)
--- a/trie.h
+++ b/trie.h
@@ -9,7 +9,7 @@
  * An entry in the trie file describing an actual file.
  */
 struct trie_file {
-    unsigned long long blocks;
+    unsigned long long size;
     unsigned long long atime;
 };
 
@@ -55,6 +55,11 @@ void triebuild_free(triebuild *tb);
  */
 
 /*
+ * Return the path separator character in use in the trie.
+ */
+char trie_pathsep(const void *t);
+
+/*
  * Return the length of the longest pathname stored in the trie,
  * including its trailing NUL.
  */
@@ -102,3 +107,19 @@ void triewalk_free(triewalk *tw);
  */
 void trie_set_index_offset(void *t, off_t ptr);
 off_t trie_get_index_offset(const void *t);
+
+/* ----------------------------------------------------------------------
+ * Utility functions not directly involved with the trie.
+ */
+
+/*
+ * Given a pathname in a buffer, adjust the pathname in place so
+ * that it points at a string which, when passed to trie_before,
+ * will reliably return the index of the thing that comes after
+ * that pathname and all its descendants. Usually this is done by
+ * suffixing ^A (since foo^A is guaranteeably the first thing that
+ * sorts after foo and foo/stuff); however, if the pathname
+ * actually ends in a path separator (e.g. if it's just "/"), that
+ * must be stripped off first.
+ */
+void make_successor(char *pathbuf);