[PATCH 4 of 6 foldmap-in-C] util.h: define an enum for normcase specs

Siddharth Agarwal sid0 at fb.com
Thu Apr 2 23:02:17 CDT 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1428027452 25200
#      Thu Apr 02 19:17:32 2015 -0700
# Node ID db7e6229985f344c66c3f079d8d86cd9bb1054ba
# Parent  10d7d813c0de992385941c042ef96eac672c3ebb
util.h: define an enum for normcase specs

These will be used in upcoming patches to efficiently create a dirstate
foldmap.

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -364,7 +364,9 @@ class normcasespecs(object):
 
     lower: normcase lowercases ASCII strings
     upper: normcase uppercases ASCII strings
-    other: the fallback function should always be called'''
+    other: the fallback function should always be called
+
+    This should be kept in sync with normcase_spec in util.h.'''
     lower = -1
     upper = 1
     other = 0
diff --git a/mercurial/util.h b/mercurial/util.h
--- a/mercurial/util.h
+++ b/mercurial/util.h
@@ -209,6 +209,13 @@ static inline double getbefloat64(const 
 	return ret;
 }
 
+/* This should be kept in sync with normcasespecs in encoding.py. */
+enum normcase_spec {
+	NORMCASE_LOWER = -1,
+	NORMCASE_UPPER = 1,
+	NORMCASE_OTHER = 0
+};
+
 #define MIN(a, b) (((a)<(b))?(a):(b))
 /* VC9 doesn't include bool and lacks stdbool.h based on my searching */
 #ifdef _MSC_VER


More information about the Mercurial-devel mailing list