]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fundamental: define size_t and memcpy for sd-boot
authorLuca Boccassi <luca.boccassi@microsoft.com>
Fri, 8 Oct 2021 12:06:51 +0000 (13:06 +0100)
committerLuca Boccassi <luca.boccassi@microsoft.com>
Fri, 8 Oct 2021 12:07:00 +0000 (13:07 +0100)
src/fundamental/macro-fundamental.h
src/fundamental/string-util-fundamental.c
src/fundamental/string-util-fundamental.h
src/fundamental/type.h

index 20d8dabf296fd5bbfcd96f58fd5a90f97be08de4..7fa4b85be7fa0d420293a96365a8c7cd77168190 100644 (file)
@@ -59,6 +59,8 @@
                 #define assert(expr) ({ _likely_(expr) ? VOID_0 : efi_assert(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); })
                 #define assert_not_reached() efi_assert("Code should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__)
         #endif
+
+        #define memcpy(a, b, c) CopyMem((a), (b), (c))
 #endif
 
 #if defined(static_assert)
index 383e390577d2e5dd481bdfeb508df02820e17f03..101d3f71962ceedf4290e2fdc7151564c41b21ca 100644 (file)
@@ -8,7 +8,7 @@
 #include "string-util-fundamental.h"
 
 sd_char *startswith(const sd_char *s, const sd_char *prefix) {
-        sd_size_t l;
+        size_t l;
 
         assert(s);
         assert(prefix);
@@ -22,7 +22,7 @@ sd_char *startswith(const sd_char *s, const sd_char *prefix) {
 
 #ifndef SD_BOOT
 sd_char *startswith_no_case(const sd_char *s, const sd_char *prefix) {
-        sd_size_t l;
+        size_t l;
 
         assert(s);
         assert(prefix);
@@ -36,7 +36,7 @@ sd_char *startswith_no_case(const sd_char *s, const sd_char *prefix) {
 #endif
 
 sd_char* endswith(const sd_char *s, const sd_char *postfix) {
-        sd_size_t sl, pl;
+        size_t sl, pl;
 
         assert(s);
         assert(postfix);
@@ -57,7 +57,7 @@ sd_char* endswith(const sd_char *s, const sd_char *postfix) {
 }
 
 sd_char* endswith_no_case(const sd_char *s, const sd_char *postfix) {
-        sd_size_t sl, pl;
+        size_t sl, pl;
 
         assert(s);
         assert(postfix);
index 7455c05492392c4fd5bf2a838a8b15d43ae0a7a6..dc0c1202be9115f544f2c3f7660e37d78230050e 100644 (file)
@@ -68,10 +68,10 @@ static inline const sd_char *yes_no(sd_bool b) {
 sd_int strverscmp_improved(const sd_char *a, const sd_char *b);
 
 /* Like startswith(), but operates on arbitrary memory blocks */
-static inline void *memory_startswith(const void *p, sd_size_t sz, const sd_char *token) {
+static inline void *memory_startswith(const void *p, size_t sz, const sd_char *token) {
         assert(token);
 
-        sd_size_t n = strlen(token) * sizeof(sd_char);
+        size_t n = strlen(token) * sizeof(sd_char);
         if (sz < n)
                 return NULL;
 
index f645d2de7fa2085afd3c18be8f54ec7d042f2697..2a9a114bbc0ccf9ff7fdb2d4ce62d916c65ecc3c 100644 (file)
@@ -7,7 +7,7 @@
 typedef BOOLEAN sd_bool;
 typedef CHAR16  sd_char;
 typedef INTN    sd_int;
-typedef UINTN   sd_size_t;
+typedef UINTN   size_t;
 
 #define true    TRUE
 #define false   FALSE
@@ -18,5 +18,4 @@ typedef UINTN   sd_size_t;
 typedef bool    sd_bool;
 typedef char    sd_char;
 typedef int     sd_int;
-typedef size_t  sd_size_t;
 #endif