[Updated] D11444: dirstate: make dirstate flags char be unsigned

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Sep 17 15:16:16 UTC 2021


Closed by commit rHGec178161a8d1: dirstate: make dirstate flags char be unsigned (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D11444?vs=30282&id=30289#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11444?vs=30282&id=30289

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11444/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11444

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/cext/util.h

CHANGE DETAILS

diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -24,21 +24,21 @@
 /* clang-format off */
 typedef struct {
 	PyObject_HEAD
-	char flags;
+	unsigned char flags;
 	int mode;
 	int size;
 	int mtime;
 } dirstateItemObject;
 /* clang-format on */
 
-static const char dirstate_flag_wc_tracked = 1;
-static const char dirstate_flag_p1_tracked = 1 << 1;
-static const char dirstate_flag_p2_tracked = 1 << 2;
-static const char dirstate_flag_possibly_dirty = 1 << 3;
-static const char dirstate_flag_merged = 1 << 4;
-static const char dirstate_flag_clean_p1 = 1 << 5;
-static const char dirstate_flag_clean_p2 = 1 << 6;
-static const char dirstate_flag_rust_special = 1 << 7;
+static const unsigned char dirstate_flag_wc_tracked = 1;
+static const unsigned char dirstate_flag_p1_tracked = 1 << 1;
+static const unsigned char dirstate_flag_p2_tracked = 1 << 2;
+static const unsigned char dirstate_flag_possibly_dirty = 1 << 3;
+static const unsigned char dirstate_flag_merged = 1 << 4;
+static const unsigned char dirstate_flag_clean_p1 = 1 << 5;
+static const unsigned char dirstate_flag_clean_p2 = 1 << 6;
+static const unsigned char dirstate_flag_rust_special = 1 << 7;
 
 extern PyTypeObject dirstateItemType;
 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType)
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -144,9 +144,10 @@
 
 static inline bool dirstate_item_c_added(dirstateItemObject *self)
 {
-	char mask = (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
-	             dirstate_flag_p2_tracked);
-	char target = dirstate_flag_wc_tracked;
+	unsigned char mask =
+	    (dirstate_flag_wc_tracked | dirstate_flag_p1_tracked |
+	     dirstate_flag_p2_tracked);
+	unsigned char target = dirstate_flag_wc_tracked;
 	return (self->flags & mask) == target;
 }
 



To: martinvonz, #hg-reviewers, Alphare, marmoute
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210917/e2a1dc48/attachment-0002.html>


More information about the Mercurial-patches mailing list