aboutsummaryrefslogtreecommitdiff
path: root/c/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/common.c')
-rw-r--r--c/common.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/c/common.c b/c/common.c
index a4debc3..af5638d 100644
--- a/c/common.c
+++ b/c/common.c
@@ -2,6 +2,7 @@
#include <SWI-Prolog.h>
#include "resource.h"
+#include "defs.h"
/* Convert zero-terminated non-wide (multi-byte) string to
* zero-terminated wide/non-wide string depending on UNICODE. */
@@ -16,14 +17,12 @@ TSZFromSZ(const char *sz, int iCp)
cbMultiByte = strlen(sz)+1;
cchWideChar = MultiByteToWideChar(iCp, 0, sz, cbMultiByte, NULL, 0);
tsz = malloc(cchWideChar*sizeof(WCHAR));
- if (!tsz)
- return NULL;
+ if (!tsz) return NULL;
if (!MultiByteToWideChar(iCp, 0, sz, cbMultiByte, tsz, cchWideChar))
return NULL;
#else
tsz = malloc(strlen(sz)+1);
- if (!tsz)
- return NULL;
+ if (!tsz) return NULL;
strcpy(tsz, sz);
#endif
@@ -34,12 +33,8 @@ int
Watched(int iEpisode)
{
term_t t;
-
- t = PL_new_term_refs(1);
- if (!PL_put_integer(t+0, iEpisode))
- return 0;
-
- return PL_call_predicate(NULL, PL_Q_NORMAL,
- PL_predicate("watched", 1, "track_episodes"),
- t);
+ t = T(1);
+ PI(t,iEpisode) return 0;
+ P("track_episodes","watched",1,t) return 0;
+ return 1;
}