Skip to content

Commit

Permalink
remove String.create in lablgladecc and release 2.18.14
Browse files Browse the repository at this point in the history
  • Loading branch information
garrigue committed Nov 14, 2023
1 parent 0f063f9 commit e38c847
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
LablGTK changes log

In Lablgtk-2.18.14:

2023.11.13 [Jacques]
* Fix use of String.create in lablgladecc (not available in ocaml 5.0)

2023.04.06 [Jacques]
* Fix a typo in the Makefile that breaks the build with newer GNU make (#168)
[Brad Smith]
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

LablGTK2 2.18.13 : an interface to the GIMP Tool Kit
LablGTK2 2.18.14 : an interface to the GIMP Tool Kit

Needed:
ocaml-4.06 or more (including 5.0)
ocaml-4.06 or more (including 5.0 and 5.1)
camlp-streams (for OCaml 5.0 or later)
gtk+-2.x (gtk+-2.16.x for full functionality)
findlib 1.2.1 or more (for default install)
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ varcc$(XE): varcc.ml
propcc$(XE): propcc.ml
$(LINKER) $(STREAMSLINK) -o $@ $<

check_externals$(XE): check_externals.cmo
$(LINKER) -o $@ $<
check_externals$(XE): check_externals.ml
$(LINKER) $(STREAMSLINK) -o $@ $<

clean:
rm -f *.cm* *.o *.a *.so *.exe *.obj *.lib *.dll *_tags.[ch] *.gch \
Expand Down
5 changes: 3 additions & 2 deletions src/check_externals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ type token =
| EOF

let rec implode l =
let s = String.create (List.length l) in
let i = ref 0 in List.iter l ~f:(fun c -> s.[!i] <- c; incr i); s
let s = Bytes.create (List.length l) in
let i = ref 0 in List.iter l ~f:(fun c -> Bytes.set s !i c; incr i);
Bytes.to_string s

let rec skip tok (strm__ : _ Stream.t) =
match Stream.peek strm__ with
Expand Down
6 changes: 3 additions & 3 deletions src/check_externals.ml4
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type token =
| EOF

let rec implode l =
let s = String.create (List.length l) in
let s = Bytes.create (List.length l) in
let i = ref 0 in
List.iter l ~f:(fun c -> s.[!i] <- c; incr i);
s
List.iter l ~f:(fun c -> Bytes.set s !i c; incr i);
Bytes.to_string s

let rec skip tok = parser [< ' tok' ; s >] -> if tok <> tok' then skip tok s

Expand Down
2 changes: 1 addition & 1 deletion src/lablgladecc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ let process ?(file="<stdin>") chan =
let lexbuf, data =
if !embed then begin
let b = Buffer.create 1024 in
let buf = String.create 1024 in
let buf = Bytes.create 1024 in
while
let len = input chan buf 0 1024 in
Buffer.add_subbytes b buf 0 len;
Expand Down

0 comments on commit e38c847

Please sign in to comment.