diff --git a/library/system/sys.c b/library/system/sys.c index 05c42060c..908373de9 100644 --- a/library/system/sys.c +++ b/library/system/sys.c @@ -139,6 +139,11 @@ #undef HAVE_ENVIRON #endif #endif +#if __ANDROID__ +#include +#include +#include +#endif void init_sys(void); @@ -295,7 +300,8 @@ list_directory(void) YAP_PutInSlot(sl,YAP_MkPairTerm(ti, YAP_GetFromSlot(sl))); } _findclose( hFile ); -#elif __ANDROID__ +#else +#if __ANDROID__ { extern AAssetManager *assetManager; const char *dirName = buf+strlen("/assets/"); @@ -312,7 +318,8 @@ list_directory(void) } AAssetDir_close(de); } -#elif HAVE_OPENDIR +#endif +#if HAVE_OPENDIR { DIR *de; struct dirent *dp; @@ -327,6 +334,7 @@ list_directory(void) closedir(de); } #endif /* HAVE_OPENDIR */ +#endif tf = YAP_GetFromSlot(sl); return YAP_Unify(YAP_ARG2, tf); } @@ -496,7 +504,7 @@ p_mktemp(void) } return(YAP_Unify(YAP_ARG2,YAP_MkAtomTerm(YAP_LookupAtom(s)))); #elif HAVE_MKSTEMP - strcpy(tmp, "/tmp/TEST_tmpXXXXXXXX"); + strcpy(tmp, "/tmp/YAP_tmpXXXXXXXX"); if(mkstemp(tmp) == -1) { /* return an error number */ return(YAP_Unify(YAP_ARG3, YAP_MkIntTerm(errno))); @@ -519,8 +527,8 @@ static int p_tmpnam(void) { #if HAVE_MKSTEMP - char s[22]; - strcpy(s, "/tmp/TEST_tmpXXXXXXXX"); + char s[21]; + strcpy(s, "/tmp/YAP_tmpXXXXXXXX"); if(mkstemp(s) == -1) return FALSE; return YAP_Unify(YAP_ARG1,YAP_MkAtomTerm(YAP_LookupAtom(s))); diff --git a/os/pl-os.c b/os/pl-os.c index a0f1e83f3..fe1daa359 100755 --- a/os/pl-os.c +++ b/os/pl-os.c @@ -493,13 +493,11 @@ setRandom(unsigned int *seedp) #endif } -#ifdef HAVE_SRANDOM +#if HAVE_SRANDOM srandom(seed); -#else -#ifdef HAVE_SRAND +#elif HAVE_SRAND srand(seed); #endif -#endif } uint64_t diff --git a/os/pl-prologflag.c b/os/pl-prologflag.c index 9ef3e5d06..1b80854d3 100755 --- a/os/pl-prologflag.c +++ b/os/pl-prologflag.c @@ -856,8 +856,6 @@ unify_prolog_flag_value(Module m, atom_t key, prolog_flag *f, term_t val) { case FT_BOOL: if ( f->index >= 0 ) { unsigned int mask = (unsigned int)1 << (f->index-1); - char *s; - s=PL_atom_chars(key); return PL_unify_bool_ex(val, truePrologFlag(mask) != FALSE); } /*FALLTHROUGH*/