]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Update long usage in regex polyfill 438/head
authorThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Thu, 18 Mar 2021 13:18:21 +0000 (08:18 -0500)
committerThomas Lam <79589038+tl-hbk@users.noreply.github.com>
Thu, 18 Mar 2021 13:22:44 +0000 (08:22 -0500)
win32/regexec.c
win32/tre-mem.c
win32/tre.h

index f22586e31318868365daa12a73b83237502bdc5f..61e40a58cd9ff6cf0dab265cb36197e6bfb43e31 100644 (file)
@@ -231,7 +231,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string,
     pbytes = sizeof(*reach_pos) * tnfa->num_states;
     xbytes = sizeof(regoff_t) * num_tags;
     total_bytes =
-      (sizeof(long) - 1) * 4 /* for alignment paddings */
+      (sizeof(size_t) - 1) * 4 /* for alignment paddings */
       + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes;
 
     /* Allocate the memory. */
@@ -242,16 +242,16 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string,
     /* Get the various pointers within tmp_buf (properly aligned). */
     tmp_tags = (void *)buf;
     tmp_buf = buf + tbytes;
-    tmp_buf += ALIGN(tmp_buf, long);
+    tmp_buf += ALIGN(tmp_buf, size_t);
     reach_next = (void *)tmp_buf;
     tmp_buf += rbytes;
-    tmp_buf += ALIGN(tmp_buf, long);
+    tmp_buf += ALIGN(tmp_buf, size_t);
     reach = (void *)tmp_buf;
     tmp_buf += rbytes;
-    tmp_buf += ALIGN(tmp_buf, long);
+    tmp_buf += ALIGN(tmp_buf, size_t);
     reach_pos = (void *)tmp_buf;
     tmp_buf += pbytes;
-    tmp_buf += ALIGN(tmp_buf, long);
+    tmp_buf += ALIGN(tmp_buf, size_t);
     for (i = 0; i < tnfa->num_states; i++)
       {
   reach[i].tags = (void *)tmp_buf;
index 0fbf7b2dc07bf94ea572f296886011437375a0a6..327515b22db297676cbe5ffc974718ea04a14a94 100644 (file)
@@ -143,7 +143,7 @@ tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block,
     }
 
   /* Make sure the next pointer will be aligned. */
-  size += ALIGN(mem->ptr + size, long);
+  size += ALIGN(mem->ptr + size, size_t);
 
   /* Allocate from current block. */
   ptr = mem->ptr;
index c07c9596c066c730c3e7e633b85d17e55a84c2d1..390df94afda792d979e0ae8366aa425459f50ad9 100644 (file)
@@ -32,6 +32,7 @@
 #include <regex.h>
 #include <wchar.h>
 #include <wctype.h>
+#include <stdint.h>
 
 #undef  TRE_MBSTATE
 
@@ -77,8 +78,8 @@ typedef wctype_t tre_ctype_t;
 /* Returns number of bytes to add to (char *)ptr to make it
    properly aligned for the type. */
 #define ALIGN(ptr, type) \
-  ((((long)ptr) % sizeof(type)) \
-   ? (sizeof(type) - (((long)ptr) % sizeof(type))) \
+  ((((uintptr_t)ptr) % sizeof(type)) \
+   ? (sizeof(type) - (((uintptr_t)ptr) % sizeof(type))) \
    : 0)
 
 #undef MAX