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

login
register
mail settings
Submitter Siddharth Agarwal
Date April 3, 2015, 4:02 a.m.
Message ID <db7e6229985f344c66c3.1428033737@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/8472/
State Accepted
Commit 1c533e23ce9533d9c5556c34cbd4122f3a0161b0
Headers show

Comments

Siddharth Agarwal - April 3, 2015, 4:02 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

Patch

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