Re: [Chicken-hackers] [PATCH] * runtime.c (C_delete_symbol_table): Remove dead code

2019-04-06 Thread Evan Hanson
Applied, thanks all.

Evan

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] [PATCH] * runtime.c (C_delete_symbol_table): Remove dead code

2019-04-05 Thread Peter Bex
On Mon, Apr 01, 2019 at 03:56:19PM +0200, felix.winkelm...@bevuta.com wrote:
> > Hi!
> > 
> > Here's a small one.
> > 
> 
> I think the original code is wrong (as this function is never used it
> didn't crash so far). We should probably remove this altogether.

Here's a patch to do exactly that.  It also removes the C_set_symbol_table
function, which I found quite odd too.

Cheers,
Peter
From e9352013a74feb25a4f09132f43dae0ddd965a38 Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Fri, 5 Apr 2019 11:18:03 +0200
Subject: [PATCH] Remove unused and undocumented C_{delete,set}_symbol_table
 functions

---
 NEWS  |  5 +
 chicken.h |  2 --
 runtime.c | 20 
 3 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/NEWS b/NEWS
index 825acbfb..ab9221fb 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@
   - When using (set-file-position!) on a port, its EOF status will now
 be reset.
 
+- Runtime system
+  - Removed the unused, undocumented (and incorrect!) C functions
+C_delete_symbol_table and C_set_symbol_table.
+
+
 5.0.1
 
 - Type system
diff --git a/chicken.h b/chicken.h
index 7a2f3a14..1a990b69 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1825,8 +1825,6 @@ C_fctexport C_word C_fcall C_evict_block(C_word from, C_word ptr) C_regparm;
 C_fctexport void C_fcall C_gc_protect(C_word **addr, int n) C_regparm;
 C_fctexport void C_fcall C_gc_unprotect(int n) C_regparm;
 C_fctexport C_SYMBOL_TABLE *C_new_symbol_table(char *name, unsigned int size) C_regparm;
-C_fctexport void C_delete_symbol_table(C_SYMBOL_TABLE *st) C_regparm;
-C_fctexport void C_set_symbol_table(C_SYMBOL_TABLE *st) C_regparm;
 C_fctexport C_SYMBOL_TABLE *C_find_symbol_table(char *name) C_regparm;
 C_fctexport C_word C_find_symbol(C_word str, C_SYMBOL_TABLE *stable) C_regparm;
 C_fctexport C_word C_fcall C_lookup_symbol(C_word sym) C_regparm;
diff --git a/runtime.c b/runtime.c
index 75cc8d41..b8bccb75 100644
--- a/runtime.c
+++ b/runtime.c
@@ -1051,26 +1051,6 @@ C_regparm C_SYMBOL_TABLE *C_new_symbol_table(char *name, unsigned int size)
 }  
 
 
-C_regparm void C_delete_symbol_table(C_SYMBOL_TABLE *st)
-{
-  C_SYMBOL_TABLE *stp, *prev = NULL;
-
-  for(stp = symbol_table_list; stp != NULL; stp = stp->next)
-if(stp == st) {
-  if(prev != NULL) prev->next = stp->next;
-  else symbol_table_list = stp->next;
-
-  return;
-}
-}
-
-
-C_regparm void C_set_symbol_table(C_SYMBOL_TABLE *st)
-{
-  symbol_table = st;
-}
-
-
 C_regparm C_SYMBOL_TABLE *C_find_symbol_table(char *name)
 {
   C_SYMBOL_TABLE *stp;
-- 
2.11.0



signature.asc
Description: PGP signature
___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


[Chicken-hackers] [PATCH] * runtime.c (C_delete_symbol_table): Remove dead code

2019-04-01 Thread felix . winkelmann
> Hi!
> 
> Here's a small one.
> 

I think the original code is wrong (as this function is never used it
didn't crash so far). We should probably remove this altogether.


felix


___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


[Chicken-hackers] [PATCH] * runtime.c (C_delete_symbol_table): Remove dead code

2019-04-01 Thread megane
Hi!

Here's a small one.

>From b0bd69d84ca7825a23a878160b65e0fa29c2e18c Mon Sep 17 00:00:00 2001
From: megane 
Date: Sun, 24 Mar 2019 10:22:08 +0200
Subject: [PATCH] * runtime.c (C_delete_symbol_table): Remove dead code

Variable prev is never assigned to. Therefore only the false branch is
ever executed.
---
 runtime.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/runtime.c b/runtime.c
index 75cc8d4..76ef599 100644
--- a/runtime.c
+++ b/runtime.c
@@ -1053,13 +1053,11 @@ C_regparm C_SYMBOL_TABLE *C_new_symbol_table(char 
*name, unsigned int size)
 
 C_regparm void C_delete_symbol_table(C_SYMBOL_TABLE *st)
 {
-  C_SYMBOL_TABLE *stp, *prev = NULL;
+  C_SYMBOL_TABLE *stp;
 
   for(stp = symbol_table_list; stp != NULL; stp = stp->next)
 if(stp == st) {
-  if(prev != NULL) prev->next = stp->next;
-  else symbol_table_list = stp->next;
-
+  symbol_table_list = stp->next;
   return;
 }
 }
-- 
2.7.4

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers