]> Repositorios git - scryer-prolog.git/commitdiff
delimit partial strings around \x0\
authorMark Thom <[email protected]>
Thu, 13 Jan 2022 05:10:59 +0000 (22:10 -0700)
committerMark Thom <[email protected]>
Thu, 13 Jan 2022 05:10:59 +0000 (22:10 -0700)
src/machine/partial_string.rs

index 87256d04d8f59711ad4c09087f82a79c85b6be2e..4430b9e3ffd12c5ba97c391702eaee313a9d1594 100644 (file)
@@ -44,10 +44,10 @@ impl PartialString {
     #[inline]
     pub(super) fn new<'a>(src: &'a str, atom_tbl: &mut AtomTable) -> Option<(Self, &'a str)> {
         let terminator_idx = scan_for_terminator(src.chars());
-        let pstr = PartialString(atom_tbl.build_with(src));
+        let pstr = PartialString(atom_tbl.build_with(&src[.. terminator_idx]));
 
-        Some(if terminator_idx != src.as_bytes().len() {
-            (pstr, &src[terminator_idx..])
+        Some(if terminator_idx  src.as_bytes().len() {
+            (pstr, &src[terminator_idx + 1..])
         } else {
             (pstr, "")
         })