From 2a726875d7ab370966bbb4b6ebb41756fc17f729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 16 Feb 2022 18:09:04 +0100 Subject: Clean up. --- c/common.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'c/common.c') 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 #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; } -- cgit v1.2.3