ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc.. Fossies Dox: ucommon-7.0.0.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 19 #include <ucommon-config.h> 33 #ifdef HAVE_STDALIGN_H 37 #if defined(_MSC_VER) && _MSC_VER >= 1800 39 #ifndef HAVE_ALIGNED_ALLOC 40 #define HAVE_ALIGNED_ALLOC 1 42 #define aligned_alloc(a, s) _aligned_malloc(s, a) 49 static int ncompare(
const void *o1,
const void *o2)
53 const StringPager::member *
const *n1 = static_cast<const StringPager::member * const*>(o1);
54 const StringPager::member *
const *n2 = static_cast<const StringPager::member * const*>(o2);
74 size_t paging = sysconf(_SC_PAGESIZE);
75 #elif defined(PAGESIZE) 76 size_t paging = PAGESIZE;
77 #elif defined(PAGE_SIZE) 78 size_t paging = PAGE_SIZE;
85 ps = (((ps + paging - 1) / paging)) * paging;
87 #if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_ALIGNED_ALLOC) 89 align =
sizeof(
void *);
126 unsigned long used = 0, alloc = 0;
148 #if defined(HAVE_ALIGNED_ALLOC) && defined(_MSWINDOWS_) 164 #ifdef HAVE_POSIX_MEMALIGN 173 #if defined(HAVE_POSIX_MEMALIGN) 178 #elif defined(HAVE_ALIGNED_ALLOC) 196 if((
size_t)(npage) %
sizeof(
void *))
197 npage->
used +=
sizeof(
void *) - ((size_t)(npage) %
sizeof(
void 214 while(
size %
sizeof(
void *))
218 if(size <= pagesize - p->used)
233 pthread_mutex_init(&
mutex, NULL);
239 pthread_mutex_init(&
mutex, NULL);
245 pthread_mutex_destroy(&
mutex);
250 pthread_mutex_lock(&
mutex);
255 pthread_mutex_unlock(&
mutex);
262 pthread_mutex_lock(&
mutex);
264 pthread_mutex_unlock(&
mutex);
270 pthread_mutex_lock(&
mutex);
272 pthread_mutex_unlock(&
mutex);
284 pthread_mutex_lock(&
mutex);
286 pthread_mutex_unlock(&
mutex);
292 pthread_mutex_lock(&source.
mutex);
293 pthread_mutex_lock(&
mutex);
295 pthread_mutex_unlock(&
mutex);
296 pthread_mutex_unlock(&source.
mutex);
545 if(mp->
Next && middle && *middle)
560 size_t tcl = strlen(text);
565 while(prior && *prior && match) {
566 #if defined(_MSWINDOWS_) 568 match = strstr(prior, text);
569 #elif defined(HAVE_STRICMP) 571 match = stristr(prior, text);
574 match = strcasestr(prior, text);
577 match = strstr(prior, text);
583 if(match == NULL && prior != NULL && found) {
610 size_t size = strlen(text) + 1;
669 size_t size = strlen(text) + 1;
689 const char *
out = NULL;
691 if(
root ==
nullptr) {
724 size_t size = strlen(text) + 1;
759 while(NULL != (cp =
list[ind++]))
771 while(NULL != (cp =
list[ind++]))
929 pthread_mutex_init(&
mutex, NULL);
934 pthread_mutex_destroy(&
mutex);
941 pthread_mutex_lock(&
mutex);
943 pthread_mutex_unlock(&
mutex);
951 pthread_mutex_lock(&
mutex);
952 ptr = static_cast<PagerObject *>(
freelist);
956 pthread_mutex_unlock(&
mutex);
static shell::stringopt out('o', "--output", _TEXT("output file"), "filename", "-")
void assign(memalloc &source)
LinkedObject * getNext(void) const
void enlist(LinkedObject **root)
static void result(const char *path, int code)
void operator+=(LinkedObject *object)
void open(const char *path)
struct ucommon::memalloc::mempage page_t
static int ncompare(const void *o1, const void *o2)
static shell::stringopt quote('q', "--quote", _TEXT("set quote for each argument"), "string", "")
virtual void release(void) __OVERRIDE
virtual void * _alloc(size_t size) __OVERRIDE
static char * token(char *text, char **last, const char *list, const char *quote=NULL, const char *end=NULL)
unsigned utilization(void) const
void retain(void) __OVERRIDE
String str(Socket &so, size_t size)
static bool is_dir(const char *path)
static uint8_t buffer[65536]
ssize_t read(char *buffer, size_t count)
static int collate(const char *text1, const char *text2)
static char * dup(const char *text)
void release(void) __OVERRIDE
const struct sockaddr * addr(Socket::address &address)