*added _ticks for apple and gnu compilers.
This commit is contained in:
parent
20e5016bb0
commit
ff11eca576
@ -2158,7 +2158,7 @@ _ls_node_t* _ls_sort(_ls_node_t** list, _ls_compare cmp) {
|
||||
int insize, nmerges, psize, qsize, i;
|
||||
_ls_node_t* lst = 0;
|
||||
|
||||
mb_assert(list && cmp);
|
||||
mb_assert(list && *list && cmp);
|
||||
|
||||
lst = *list;
|
||||
if(lst) lst = lst->next;
|
||||
@ -2775,7 +2775,7 @@ char* mb_strupr(char* s) {
|
||||
/** Unicode handling */
|
||||
#ifdef MB_ENABLE_UNICODE
|
||||
int mb_uu_ischar(char* ch) {
|
||||
/* Copyright 2008-2009 Bjoern Hoehrmann, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ */
|
||||
/* Copyright 2008, 2009 Bjoern Hoehrmann, http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ */
|
||||
/* Determine whether a buffer is a UTF8 encoded character, and return taken bytes */
|
||||
#define _TAKE(__ch, __c, __r) do { __c = *__ch++; __r++; } while(0)
|
||||
#define _COPY(__ch, __c, __r, __cp) do { _TAKE(__ch, __c, __r); __cp = (__cp << 6) | ((unsigned char)__c & 0x3Fu); } while(0)
|
||||
|
2
makefile
2
makefile
@ -1,5 +1,5 @@
|
||||
my_basic : main.o my_basic.o
|
||||
cc -o output/my_basic_bin main.o my_basic.o -lm
|
||||
cc -o output/my_basic_bin main.o my_basic.o -lm -lrt
|
||||
|
||||
main.o : shell/main.c core/my_basic.h
|
||||
cc -Os -c shell/main.c -Wno-unused-result
|
||||
|
11
shell/main.c
11
shell/main.c
@ -37,6 +37,9 @@
|
||||
#elif !defined __BORLANDC__ && !defined __TINYC__
|
||||
# include <unistd.h>
|
||||
#endif /* _MSC_VER */
|
||||
#ifndef _MSC_VER
|
||||
# include <stdint.h>
|
||||
#endif /* _MSC_VER */
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -1077,6 +1080,14 @@ static int_t _ticks(void) {
|
||||
|
||||
return ret;
|
||||
}
|
||||
#elif defined __APPLE__ || defined __GNUC__
|
||||
static int_t _ticks(void) {
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
#else /* _MSC_VER */
|
||||
# undef _HAS_TICKS
|
||||
#endif /* _MSC_VER */
|
||||
|
Loading…
x
Reference in New Issue
Block a user