aboutsummaryrefslogtreecommitdiff
path: root/c/pl.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-02 23:50:58 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-02 23:50:58 +0200
commit23dc657f0af27bdac887f8d18208d544cc9f010e (patch)
treea2656d96f11f879d6a4233fef736493a1cc39ba6 /c/pl.h
parentedce20642b6d177ee9877775cbfa9e05ebb4e404 (diff)
downloadEpisodeBrowser-23dc657f0af27bdac887f8d18208d544cc9f010e.tar.gz
Improve wstring_owner, rename to wchar_ptr.
The user-defined conversion function makes the interface a lot simpler AND safer.
Diffstat (limited to 'c/pl.h')
-rw-r--r--c/pl.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/c/pl.h b/c/pl.h
index 1c526a0..28e13b0 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -7,7 +7,7 @@
#include "common.h"
-wstring_owner PlString(const term_t t, const int flags = CVT_WRITE);
+wchar_ptr PlString(const term_t t, const int flags = CVT_WRITE);
struct Frame
{
@@ -54,7 +54,7 @@ inline int PlPut(term_t, long*) { return -1; }
inline int PlPut(term_t, long long*) { return -1; }
inline int PlPut(term_t, atom_t*) { return -1; }
inline int PlPut(term_t, char**) { return -1; }
-inline int PlPut(term_t, wstring_owner*) { return -1; }
+inline int PlPut(term_t, wchar_ptr*) { return -1; }
inline int PlGet(term_t, int) { return -1; }
inline int PlGet(term_t, long) { return -1; }
@@ -67,11 +67,11 @@ inline int PlGet(term_t t, long* x) { return PL_get_long(t, x); }
inline int PlGet(term_t t, long long* x) { return PL_get_int64(t, x); }
inline int PlGet(term_t t, atom_t* x) { return PL_get_atom(t, x); }
inline int PlGet(term_t t, char** x) { return PL_get_atom_chars(t, x); }
-inline int PlGet(term_t t, wstring_owner* x) {
+inline int PlGet(term_t t, wchar_ptr* x) {
Mark m;
char* s;
if (!PlGet(t, &s)) return 0;
- *x = wstring_owner::from_narrow(s);
+ *x = wchar_ptr::from_narrow(s);
return 1; /* or catch potential exception from BstrFromSz? */
}