From 6b9fcd9759ad32dcc9fdc9c60e13946b0b6e8f19 Mon Sep 17 00:00:00 2001 From: Jeffrey Brian Arnold Date: Sun, 15 Jun 2008 22:05:16 -0400 Subject: [PATCH] Change starts_with and ends_with to functions. Signed-off-by: Jeffrey Brian Arnold --- kmodsrc/allcommon.c | 11 +++++++++++ kmodsrc/allcommon.h | 5 ++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/kmodsrc/allcommon.c b/kmodsrc/allcommon.c index eb669f8..89199f6 100644 --- a/kmodsrc/allcommon.c +++ b/kmodsrc/allcommon.c @@ -16,6 +16,17 @@ #include "allcommon.h" +int starts_with(const char *str, const char *prefix) +{ + return !strncmp(str, prefix, strlen(prefix)); +} + +int ends_with(const char *str, const char *suffix) +{ + return (strlen(str) > strlen(suffix) + && !strcmp(&str[strlen(str) - strlen(suffix)], suffix)); +} + int label_offset(const char *sym_name) { int i; diff --git a/kmodsrc/allcommon.h b/kmodsrc/allcommon.h index 38a4566..452cc21 100644 --- a/kmodsrc/allcommon.h +++ b/kmodsrc/allcommon.h @@ -1,9 +1,8 @@ #include #include -#define starts_with(str, prefix) (!strncmp(str, prefix, strlen(prefix))) -#define ends_with(str, suffix) (strlen(str) > strlen(suffix) && !strcmp(&str[strlen(str)-strlen(suffix)], suffix)) - +int starts_with(const char *str, const char *prefix); +int ends_with(const char *str, const char *suffix); int label_offset(const char *sym_name); const char *only_label(const char *sym_name); const char *dup_wolabel(const char *sym_name); -- 2.11.4.GIT