mirror of
https://github.com/GOSTSec/sgminer
synced 2025-08-26 05:41:55 +00:00
Moved strsep() implementation from winbuild.h to compat.h
This commit is contained in:
parent
83b2ac9ec7
commit
1965131784
31
compat.h
31
compat.h
@ -70,24 +70,29 @@ static inline int setpriority(__maybe_unused int which, __maybe_unused int who,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//implement strsep() for windows
|
#ifndef HAVE_STRSEP
|
||||||
static char* strsep(char** stringp, const char* delim)
|
inline char *strsep(char **stringp, const char *delim)
|
||||||
{
|
{
|
||||||
char* start = *stringp;
|
char *res;
|
||||||
char* p;
|
|
||||||
|
|
||||||
p = ((start != NULL)?strpbrk(start, delim):NULL);
|
if (!stringp || !*stringp || !**stringp) {
|
||||||
|
return NULL;
|
||||||
if(p == NULL)
|
|
||||||
*stringp = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*p = '\0';
|
|
||||||
*stringp = p + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return start;
|
res = *stringp;
|
||||||
|
while(**stringp && !strchr(delim, **stringp)) {
|
||||||
|
++(*stringp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (**stringp) {
|
||||||
|
**stringp = '\0';
|
||||||
|
++(*stringp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef unsigned long int ulong;
|
typedef unsigned long int ulong;
|
||||||
typedef unsigned short int ushort;
|
typedef unsigned short int ushort;
|
||||||
|
32
winbuild/dist/include/winbuild.h
vendored
32
winbuild/dist/include/winbuild.h
vendored
@ -1,6 +1,5 @@
|
|||||||
#ifndef __WINBUILD_H__
|
#ifndef WINBUILD_H
|
||||||
#define __WINBUILD_H__
|
#define WINBUILD_H
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
@ -131,29 +130,6 @@ inline void* memmem (void* buf, size_t buflen, void* pat, size_t patlen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_STRSEP
|
|
||||||
inline char *strsep(char **stringp, const char *delim)
|
|
||||||
{
|
|
||||||
char *res;
|
|
||||||
|
|
||||||
if (!stringp || !*stringp || !**stringp) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = *stringp;
|
|
||||||
while(**stringp && !strchr(delim, **stringp)) {
|
|
||||||
++(*stringp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (**stringp) {
|
|
||||||
**stringp = '\0';
|
|
||||||
++(*stringp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list))
|
#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list))
|
||||||
|
|
||||||
#define usleep(x) Sleep((x)/1000)
|
#define usleep(x) Sleep((x)/1000)
|
||||||
@ -162,5 +138,5 @@ inline char *strsep(char **stringp, const char *delim)
|
|||||||
#define __func__ __FUNCTION__
|
#define __func__ __FUNCTION__
|
||||||
#define __attribute__(x)
|
#define __attribute__(x)
|
||||||
|
|
||||||
|
#endif /* _MSC_VER */
|
||||||
#endif
|
#endif /* WINBUILD_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user