fix code spacings
This commit is contained in:
parent
b80fe62700
commit
b03cf8ec73
2 changed files with 9 additions and 9 deletions
16
string.c
16
string.c
|
|
@ -9,19 +9,19 @@ size_t cu_strlen(const char* str)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cu_strcpy(char* dst,const char* src)
|
void cu_strcpy(char* dst, const char* src)
|
||||||
{
|
{
|
||||||
while((*dst++ = *src++)){}
|
while((*dst++ = *src++)){}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cu_strncpy(char* dst,const char* src,size_t maxLen)
|
void cu_strncpy(char* dst, const char* src, size_t maxLen)
|
||||||
{
|
{
|
||||||
maxLen=-1;
|
maxLen=-1;
|
||||||
while((*dst++ = *src++) && --maxLen){}
|
while((*dst++ = *src++) && --maxLen){}
|
||||||
if(!maxLen) dst[maxLen] = '\0';
|
if(!maxLen) dst[maxLen] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cu_strchr(const char* src,char chr)
|
const char* cu_strchr(const char* src, char chr)
|
||||||
{
|
{
|
||||||
while(*src)
|
while(*src)
|
||||||
{
|
{
|
||||||
|
|
@ -31,7 +31,7 @@ const char* cu_strchr(const char* src,char chr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cu_strrchr(const char* src,char chr)
|
const char* cu_strrchr(const char* src, char chr)
|
||||||
{
|
{
|
||||||
const char* ptr;
|
const char* ptr;
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ const char* cu_strrchr(const char* src,char chr)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cu_strcmp(const char* src,const char* dst)
|
int cu_strcmp(const char* src, const char* dst)
|
||||||
{
|
{
|
||||||
if(cu_strlen(src) != cu_strlen(dst)) return 1;
|
if(cu_strlen(src) != cu_strlen(dst)) return 1;
|
||||||
while(*src)
|
while(*src)
|
||||||
|
|
@ -52,12 +52,12 @@ int cu_strcmp(const char* src,const char* dst)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cu_strncmp(const char* haystack,char* needle)
|
int cu_strncmp(const char* haystack, char* needle)
|
||||||
{
|
{
|
||||||
return !!cu_memcmp(haystack,needle,cu_strlen(needle));
|
return !!cu_memcmp(haystack,needle,cu_strlen(needle));
|
||||||
}
|
}
|
||||||
|
|
||||||
int cu_strcasecmp(const char* src,const char* dst)
|
int cu_strcasecmp(const char* src, const char* dst)
|
||||||
{
|
{
|
||||||
if(cu_strlen(src) != cu_strlen(dst)) return 1;
|
if(cu_strlen(src) != cu_strlen(dst)) return 1;
|
||||||
while(*src)
|
while(*src)
|
||||||
|
|
@ -113,7 +113,7 @@ size_t cu_dbcslen(dbcs_t chr)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cu_dbcs2str(dbcs_t* dbcs,char* str,size_t maxStr)
|
void cu_dbcs2str(dbcs_t* dbcs, char* str, size_t maxStr)
|
||||||
{
|
{
|
||||||
char* end = str + maxStr - 1;
|
char* end = str + maxStr - 1;
|
||||||
dbcs_t wc;
|
dbcs_t wc;
|
||||||
|
|
|
||||||
2
string.h
2
string.h
|
|
@ -46,6 +46,6 @@ void cu_sprintf(char* dst, size_t maxLen, const char* fmt, ...);
|
||||||
// example: cu_sscanf((char*)str4, "\"%s\" %d", str5, 8, &val5);
|
// example: cu_sscanf((char*)str4, "\"%s\" %d", str5, 8, &val5);
|
||||||
// where %s is str5 buffer pointer and 8 is size of buffer
|
// where %s is str5 buffer pointer and 8 is size of buffer
|
||||||
// and &val5 is pointer to iword integer
|
// and &val5 is pointer to iword integer
|
||||||
void cu_sscanf(char* buf, char* fmt,...);
|
void cu_sscanf(char* buf, char* fmt, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Add table
Reference in a new issue