Some fixes/improvements to libgst

Lee Duhem <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <CAOSer0ATepPTOLveqb8SCGTqwJO9=SEpAj-zdrB8JwSWjb07_g@mail.gmail.com>
Hi,

The attached patch provides some fixes and/or improvements to libgst.
You may want to take a look.

Regards,
lee

2016-12-30  Lee Duhem  <[email protected]>

* byte.c (_gst_compile_bytecodes): Remove unnecessary copy.
* comp.c (_gst_compile_method): Protect new created `selector' from GC
properly.
* gst-parse.c (expected): Call va_end.

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
0001-libgst-Misc-improvements.patch (text/x-patch, 2.7 KB)
From 8d6652fddeb7ff7289e8a38d617ff94db7ec3934 Mon Sep 17 00:00:00 2001
From: Lee Duhem <[email protected]>
Date: Fri, 30 Dec 2016 14:34:47 -0600
Subject: [PATCH] libgst: Misc improvements

2016-12-30  Lee Duhem  <[email protected]>

	* byte.c (_gst_compile_bytecodes): Remove unnecessary copy.
	* comp.c (_gst_compile_method): Protect new created `selector' from GC
	properly.
	* gst-parse.c (expected): Call va_end.
---
 libgst/ChangeLog   | 7 +++++++
 libgst/byte.c      | 3 ---
 libgst/comp.c      | 3 +--
 libgst/gst-parse.c | 1 +
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/libgst/ChangeLog b/libgst/ChangeLog
index 0cb646f..64494c5 100644
--- a/libgst/ChangeLog
+++ b/libgst/ChangeLog
@@ -1,5 +1,12 @@
 2016-12-30  Lee Duhem  <[email protected]>
 
+	* byte.c (_gst_compile_bytecodes): Remove unnecessary copy.
+	* comp.c (_gst_compile_method): Protect new created `selector' from GC
+	properly.
+	* gst-parse.c (expected): Call va_end.
+
+2016-12-30  Lee Duhem  <[email protected]>
+
 	* comp.h: Improve comments.
 	* comp.c: Ditto.
 	* files.c: Fix typos in comments.
diff --git a/libgst/byte.c b/libgst/byte.c
index 50ff07c..a90a139 100644
--- a/libgst/byte.c
+++ b/libgst/byte.c
@@ -450,9 +450,6 @@ _gst_compile_bytecodes (gst_uchar * from,
 
   if (free < (to - from))
     {
-      memcpy (_gst_cur_bytecodes->ptr, from, free);
-      _gst_cur_bytecodes->ptr += free;
-      from += free;
       realloc_bytecodes (_gst_cur_bytecodes,
 		         BYTECODE_CHUNK_SIZE + (to - from));
     }
diff --git a/libgst/comp.c b/libgst/comp.c
index f08d057..8f94ce4 100644
--- a/libgst/comp.c
+++ b/libgst/comp.c
@@ -727,6 +727,7 @@ _gst_compile_method (tree_node method,
   _gst_alloc_bytecodes ();
   _gst_push_new_scope ();
   selector = compute_selector (method->v_method.selectorExpr);
+  INC_ADD_OOP (selector);
 
   _gst_compiler_state->debugInfoDict = _gst_identity_dictionary_new (_gst_identity_dictionary_class, 6);
   INC_ADD_OOP (_gst_compiler_state->debugInfoDict);
@@ -742,8 +743,6 @@ _gst_compile_method (tree_node method,
   else
     _gst_line_number (method->location.first_line, LN_RESET | LN_ABSOLUTE);
 
-  INC_ADD_OOP (selector);
-
   if (_gst_declare_tracing)
     printf ("  class %O, selector %O\n", method->v_method.currentClass, selector);
 
diff --git a/libgst/gst-parse.c b/libgst/gst-parse.c
index bd551d8..5fd4f54 100644
--- a/libgst/gst-parse.c
+++ b/libgst/gst-parse.c
@@ -509,6 +509,7 @@ expected (gst_parser *p, int token, ...)
 	named_tokens |= 1 << (token - FIRST_TOKEN);
       token = va_arg (ap, int);
     }
+  va_end (ap);
 
 #define TOKEN_DEF(name, val, str, subsume)				\
   if ((named_tokens & (1 << (val - FIRST_TOKEN))) != 0			\
-- 
2.6.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.