shortcut str_len to strlen on dietlibc
This commit is contained in:
parent
cd666a2b09
commit
f828d295ce
5
str.h
5
str.h
@ -27,8 +27,13 @@ extern int str_diff(const char *a,const char *b) __pure__;
|
|||||||
* limit characters match. */
|
* limit characters match. */
|
||||||
extern int str_diffn(const char *a,const char *b,unsigned int limit) __pure__;
|
extern int str_diffn(const char *a,const char *b,unsigned int limit) __pure__;
|
||||||
|
|
||||||
|
#ifdef __dietlibc__
|
||||||
|
#include <string.h>
|
||||||
|
#define str_len(foo) strlen(foo)
|
||||||
|
#else
|
||||||
/* str_len returns the index of \0 in s */
|
/* str_len returns the index of \0 in s */
|
||||||
extern unsigned int str_len(const char *s) __pure__;
|
extern unsigned int str_len(const char *s) __pure__;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* str_chr returns the index of the first occurance of needle or \0 in haystack */
|
/* str_chr returns the index of the first occurance of needle or \0 in haystack */
|
||||||
extern unsigned int str_chr(const char *haystack,char needle) __pure__;
|
extern unsigned int str_chr(const char *haystack,char needle) __pure__;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "str.h"
|
#include "str.h"
|
||||||
|
|
||||||
#ifdef __dietlibc__
|
#ifdef __dietlibc__
|
||||||
|
#undef str_len
|
||||||
unsigned int str_len(const char* in) __attribute__((alias("strlen")));
|
unsigned int str_len(const char* in) __attribute__((alias("strlen")));
|
||||||
#else
|
#else
|
||||||
unsigned int str_len(const char* in) {
|
unsigned int str_len(const char* in) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user