summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/compiler.h3
-rw-r--r--lib/console.c2
-rw-r--r--mok.c4
-rw-r--r--shim.h5
4 files changed, 6 insertions, 8 deletions
diff --git a/include/compiler.h b/include/compiler.h
index 48ec009a..4e44840d 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -149,5 +149,8 @@
#define ALIGN_DOWN(x, a) __ALIGN((x) - ((a) - 1), (a))
#endif
+#define MIN(a, b) ({(a) < (b) ? (a) : (b);})
+#define MAX(a, b) ({(a) <= (b) ? (b) : (a);})
+
#endif /* !COMPILER_H_ */
// vim:fenc=utf-8:tw=75:et
diff --git a/lib/console.c b/lib/console.c
index ecd5c0e0..00a7baad 100644
--- a/lib/console.c
+++ b/lib/console.c
@@ -213,7 +213,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight,
if (col < 0)
col = 0;
- CopyMem(Line + col + 1, s, min(len, size_cols - 2)*2);
+ CopyMem(Line + col + 1, s, MIN(len, size_cols - 2)*2);
}
if (line >= 0 && line == highlight)
co->SetAttribute(co, EFI_LIGHTGRAY |
diff --git a/mok.c b/mok.c
index fafcf9f0..c8de6a69 100644
--- a/mok.c
+++ b/mok.c
@@ -253,7 +253,7 @@ mirror_one_esl(CHAR16 *name, EFI_GUID *guid, UINT32 attrs,
SIZE_T howmany, varsz = 0, esdsz;
UINT8 *var, *data;
- howmany = min((maxsz - sizeof(*esl)) / esl->SignatureSize,
+ howmany = MIN((maxsz - sizeof(*esl)) / esl->SignatureSize,
(esl->SignatureListSize - sizeof(*esl)) / esl->SignatureSize);
if (howmany < 1) {
return EFI_BUFFER_TOO_SMALL;
@@ -411,7 +411,7 @@ mirror_mok_db(CHAR16 *name, CHAR8 *name8, EFI_GUID *guid, UINT32 attrs,
SIZE_T howmany;
UINTN adj = 0;
- howmany = min((max_var_sz - sizeof(*esl)) / esl->SignatureSize,
+ howmany = MIN((max_var_sz - sizeof(*esl)) / esl->SignatureSize,
(esl->SignatureListSize - sizeof(*esl)) / esl->SignatureSize);
if (!only_first && i == 0 && howmany >= 1) {
adj = howmany * esl->SignatureSize;
diff --git a/shim.h b/shim.h
index fe750e46..44c01555 100644
--- a/shim.h
+++ b/shim.h
@@ -35,8 +35,6 @@
#define nonnull(...) __attribute__((__nonnull__(__VA_ARGS__)))
-#define min(a, b) ({(a) < (b) ? (a) : (b);})
-
#ifdef __x86_64__
#ifndef DEFAULT_LOADER
#define DEFAULT_LOADER L"\\grubx64.efi"
@@ -233,7 +231,4 @@ verify_buffer (char *data, int datasize,
#define LogError(fmt, ...) \
LogError_(__FILE__, __LINE__ - 1, __func__, fmt, ##__VA_ARGS__)
-#define MIN(a, b) (((a) <= (b))?(a):(b))
-#define MAX(a, b) (((a) <= (b))?(b):(a))
-
#endif /* SHIM_H_ */