X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Fembryo_str.c;h=0c2faa2d159f9393100e9bed5b39cc5c7536ee3c;hb=b9bf26beb041831a1fdc6e97d268b068e6df3cb0;hp=2ed03c7a75181220d37f6a08f5733ccea9628d19;hpb=226c11fd641bb3bdcb28c01b52b19227729878f3;p=framework%2Fuifw%2Fembryo.git diff --git a/src/lib/embryo_str.c b/src/lib/embryo_str.c index 2ed03c7..0c2faa2 100644 --- a/src/lib/embryo_str.c +++ b/src/lib/embryo_str.c @@ -1,9 +1,44 @@ -/* - * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 - */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_ALLOCA_H +# include +#elif !defined alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif !defined HAVE_ALLOCA +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +#ifdef HAVE_EXOTIC +# include +#endif + +#include +#include +#include +#include +#include "Embryo.h" #include "embryo_private.h" -#include #define STRGET(ep, str, par) { \ Embryo_Cell *___cptr; \ @@ -254,7 +289,7 @@ _embryo_str_snprintf(Embryo_Program *ep, Embryo_Cell *params) /* params[2] = bufsize */ /* params[3] = format_string */ /* params[4] = first arg ... */ - if (params[0] < (3 * sizeof(Embryo_Cell))) return 0; + if (params[0] < (Embryo_Cell)(3 * sizeof(Embryo_Cell))) return 0; if (params[2] <= 0) return 0; STRGET(ep, s1, params[3]); if (!s1) return -1; @@ -403,7 +438,7 @@ _embryo_str_strstr(Embryo_Program *ep, Embryo_Cell *params) STRGET(ep, s2, params[2]); if ((!s1) || (!s2)) return -1; p = strstr(s1, s2); - if (p == NULL) return -1; + if (!p) return -1; return (Embryo_Cell)(p - s1); } @@ -417,8 +452,9 @@ _embryo_str_strchr(Embryo_Program *ep, Embryo_Cell *params) if (params[0] != (2 * sizeof(Embryo_Cell))) return 0; STRGET(ep, s1, params[1]); STRGET(ep, s2, params[2]); + if ((!s1) || (!s2)) return -1; p = strchr(s1, s2[0]); - if (p == NULL) return -1; + if (!p) return -1; return (Embryo_Cell)(p - s1); } @@ -432,8 +468,9 @@ _embryo_str_strrchr(Embryo_Program *ep, Embryo_Cell *params) if (params[0] != (2 * sizeof(Embryo_Cell))) return 0; STRGET(ep, s1, params[1]); STRGET(ep, s2, params[2]); + if ((!s1) || (!s2)) return -1; p = strrchr(s1, s2[0]); - if (p == NULL) return -1; + if (!p) return -1; return (Embryo_Cell)(p - s1); }