--- parser3/src/include/pa_common.h 2024/10/02 22:54:03 1.194 +++ parser3/src/include/pa_common.h 2026/09/18 20:08:37 1.199 @@ -1,14 +1,14 @@ /** @file Parser: commonly used functions. - Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ #ifndef PA_COMMON_H #define PA_COMMON_H -#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.194 2024/10/02 22:54:03 moko Exp $" +#define IDENT_PA_COMMON_H "$Id: pa_common.h,v 1.199 2026/09/18 20:08:37 moko Exp $" #include "pa_string.h" #include "pa_hash.h" @@ -99,7 +99,7 @@ FILE *pa_fopen(const char *pathname, con file related functions */ -#define FILE_BUFFER_SIZE 4096 +#define FILE_BUFFER_SIZE (128*0x400) int pa_lock_shared_blocking(int fd); int pa_lock_exclusive_blocking(int fd); @@ -223,11 +223,21 @@ ssize_t file_block_read(const int f, voi void fix_line_breaks(char *str, size_t& length /* < may change! used to speedup next actions */); char *getrow(char **row_ref,char delim='\n'); + +// Return the last occurrence of any character in chars or NULL if absent +const char *strrpbrk(const char *string, const char *chars); +inline char *strrpbrk(char *string, const char *chars) { + return (char*)strrpbrk((const char*)string, chars); +} + +// Split at the first occurrence of delimiter; return the suffix or NULL if absent char *lsplit(char *string, char delim); -char *lsplit(char **string_ref,char delim); -char *rsplit(char *string, char delim); +// Return the prefix; advance *string_ref to the suffix or set it to NULL if delimiter is absent +char *lsplit(char **string_ref, char delim); -const char* format_double(double value, const char *fmt); +// Split at the last occurrence of delimiter(s); return the suffix or NULL if absent +char *rsplit(char *string, char delim); +char *rsplit(char *string, const char *delims); char* unescape_chars(const char* cp, int len, Charset* client_charset=0, bool js=false/*true==decode \uXXXX and don't convert '+' to space*/); @@ -308,4 +318,3 @@ enum Table2hash_value_type { C_HASH, C_S #endif #endif -