mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-02 17:50:44 +08:00
Add helper
This commit is contained in:
parent
96a2b95887
commit
2cc99b7824
25
helper.h
Normal file
25
helper.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
/* --------------------------------------------------------------
|
||||||
|
* File : helper.h
|
||||||
|
* Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
|
* Created on : <2023-08-28>
|
||||||
|
* Last modified : <2023-08-28>
|
||||||
|
*
|
||||||
|
* helper:
|
||||||
|
*
|
||||||
|
* helper functions and macros
|
||||||
|
* -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
|
|
||||||
|
char*
|
||||||
|
xy_strjoin(const char* str1, const char* str2)
|
||||||
|
{
|
||||||
|
size_t len = strlen(str1) + strlen(str2) + 1;
|
||||||
|
char* ret = malloc(len);
|
||||||
|
strcat(ret, str1);
|
||||||
|
strcat(ret, str2);
|
||||||
|
return ret;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user