summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-19 17:32:49 -0500
committermidipix <writeonce@midipix.org>2016-11-19 17:39:37 -0500
commit3f9c39c71d290cbe9e4a8f321658a6e00bec5338 (patch)
tree63db4f57fc84166d220044cf7d30e554e0496f8a
parent845777b5df3c7a6cd48525449f08b9cfd2b7c8a2 (diff)
downloadpemagine-3f9c39c71d290cbe9e4a8f321658a6e00bec5338.tar.bz2
pemagine-3f9c39c71d290cbe9e4a8f321658a6e00bec5338.tar.xz
pe_impl.h: linkage: helper string functions are now static inlined functions.
-rw-r--r--project/common.mk1
-rw-r--r--src/internal/pe_impl.c49
-rw-r--r--src/internal/pe_impl.h49
3 files changed, 46 insertions, 53 deletions
diff --git a/project/common.mk b/project/common.mk
index 1b98bcd..6563de5 100644
--- a/project/common.mk
+++ b/project/common.mk
@@ -10,7 +10,6 @@ COMMON_SRCS = \
src/headers/pe_get_image_section_tbl_addr.c \
src/headers/pe_get_image_special_hdr_addr.c \
src/imports/pe_enum_image_import_hdrs.c \
- src/internal/pe_impl.c \
src/internal/pe_entry_point.c \
src/meta/pe_get_image_stack_heap_info.c \
src/meta/pe_get_symbol_module_info.c \
diff --git a/src/internal/pe_impl.c b/src/internal/pe_impl.c
deleted file mode 100644
index 96780c9..0000000
--- a/src/internal/pe_impl.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*****************************************************************************/
-/* pemagination: a (virtual) tour into portable bits and executable bytes */
-/* Copyright (C) 2013,2014,2015 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.PEMAGINE. */
-/*****************************************************************************/
-
-#include <psxtypes/psxtypes.h>
-#include <pemagine/pemagine.h>
-#include "pe_impl.h"
-
-int32_t pe_impl_strlen_ansi(const char * str)
-{
- const char * ch;
- const char * upper_bound;
-
- upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
-
- for (ch=str; *ch && ch<upper_bound; )
- ch++;
-
- return (ch < upper_bound)
- ? ch - str
- : -1;
-}
-
-
-int32_t pe_impl_strlen_utf16(const wchar16_t * str)
-{
- const wchar16_t * wch;
- const wchar16_t * upper_bound;
-
- upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
-
- for (wch=str; *wch && wch<upper_bound; )
- wch++;
-
- if (wch < upper_bound)
- return (wch - str) * sizeof(wchar16_t);
- else
- return -1;
-}
-
-
-wchar16_t pe_impl_utf16_char_to_lower(const wchar16_t c)
-{
- return ((c >= 'A') && (c <= 'Z'))
- ? c + 'a' - 'A'
- : c;
-}
diff --git a/src/internal/pe_impl.h b/src/internal/pe_impl.h
index 43ec6ef..27c156d 100644
--- a/src/internal/pe_impl.h
+++ b/src/internal/pe_impl.h
@@ -1,3 +1,9 @@
+/*****************************************************************************/
+/* pemagination: a (virtual) tour into portable bits and executable bytes */
+/* Copyright (C) 2013,2014,2015 Z. Gilboa */
+/* Released under GPLv2 and GPLv3; see COPYING.PEMAGINE. */
+/*****************************************************************************/
+
#include <psxtypes/psxtypes.h>
#include <pemagine/pemagine.h>
@@ -12,6 +18,43 @@ struct pe_block {
uint32_t size;
};
-int32_t pe_impl_strlen_ansi(const char * str);
-int32_t pe_impl_strlen_utf16(const wchar16_t * str);
-wchar16_t pe_impl_utf16_char_to_lower(const wchar16_t c);
+
+static inline int32_t pe_impl_strlen_ansi(const char * str)
+{
+ const char * ch;
+ const char * upper_bound;
+
+ upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
+
+ for (ch=str; *ch && ch<upper_bound; )
+ ch++;
+
+ return (ch < upper_bound)
+ ? ch - str
+ : -1;
+}
+
+
+static inline int32_t pe_impl_strlen_utf16(const wchar16_t * str)
+{
+ const wchar16_t * wch;
+ const wchar16_t * upper_bound;
+
+ upper_bound = str + PE_STR_MAX_SYMBOL_LEN_ALLOWED;
+
+ for (wch=str; *wch && wch<upper_bound; )
+ wch++;
+
+ if (wch < upper_bound)
+ return (wch - str) * sizeof(wchar16_t);
+ else
+ return -1;
+}
+
+
+static inline wchar16_t pe_impl_utf16_char_to_lower(const wchar16_t c)
+{
+ return ((c >= 'A') && (c <= 'Z'))
+ ? c + 'a' - 'A'
+ : c;
+}