From 2b1f534ea407a8ec0b94e0389a360f6cdff54598 Mon Sep 17 00:00:00 2001 From: liuxiaolong <liuxiaolong@aiotlink.com> Date: 星期三, 08 九月 2021 14:02:38 +0800 Subject: [PATCH] call C.BHFree after return success --- include/usgcommon/usg_common.h | 41 +++++++++++++++++++++++++++++++++-------- 1 files changed, 33 insertions(+), 8 deletions(-) diff --git a/include/usgcommon/usg_common.h b/include/usgcommon/usg_common.h index 20fefe9..ba90002 100644 --- a/include/usgcommon/usg_common.h +++ b/include/usgcommon/usg_common.h @@ -22,6 +22,7 @@ #include <sched.h> #include <sys/time.h> +#include <sys/syscall.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> @@ -45,6 +46,7 @@ #include <stdint.h> #include <assert.h> + #ifdef __cplusplus } #endif @@ -59,23 +61,33 @@ #include <fstream> #include <sstream> #include <string> + #include <cstdlib> #include <atomic> #include <algorithm> #include <iomanip> #include <limits> + #include <initializer_list> #include <vector> #include <map> #include <set> + +#include <functional> #include <thread> - #endif +#include "usg_typedef.h" #ifdef __cplusplus extern "C" { #endif + +/* Signal wrappers */ +typedef void handler_t(int); +handler_t *Signal(int signum, handler_t *handler); + + /* Our own error-handling functions */ @@ -86,19 +98,32 @@ char *rtrim(char *str, const char *seps); char *trim(char *str, const char *seps); +/** + * @ seperator 鍒嗗壊绗� + */ +char * str_join( const char *seperator, const char *first, ...); +/** + * 鎶婂瓧绗︿覆浠delim鍒嗗壊涓烘暟缁勶紝鏁扮粍鐨勫湴鍧�瀛樻斁鍦ˊarr_addr + */ +int str_split(const char *str, const char *delim, char *** arr_addr); +char * array_join(char * const arr[], const char *seperator); +char * path_join(const char *path, ...); +// 鍙嶅悜鏌ヨ +char *strstr_r(char *str, char * needle); +// 閫掑綊鍒涘缓鏂囦欢澶� +int mkdir_r(const char *pathname, mode_t mode); + +int mkdiratfd_r(int dirfd, const char *pathname, mode_t mode); +int mkdirat_r(const char * dir, const char *pathname, mode_t mode); + + static inline int -itoa(int num, char *str) +strtoi(int num, char *str) { return sprintf(str, "%d", num); } -static inline int -ftoa(float num, char *str) -{ - return sprintf(str, "%f", num); - -} -- Gitblit v1.8.0