Remove unnecessary frees. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 6db38896e8c2d17bcd2a3534c26bf507f9614f3c
(DIR) parent 84b051c7d9d429d3f6dda596a9d01e9a85652c82
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Thu, 20 Oct 2016 17:24:29 -0500
Remove unnecessary frees.
Diffstat:
sam/cmd.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
---
(DIR) diff --git a/sam/cmd.c b/sam/cmd.c
@@ -284,19 +284,18 @@ freecmd(void)
{
int i;
- while(cmdlist.nused > 0){
- Cmd *c = (Cmd *)cmdlist.uint8_tpptr[--cmdlist.nused];
- /* XXX if (c->ctext)
- free(c->ctext); */
- free(c);
- }
+ while(cmdlist.nused > 0)
+ free(cmdlist.uint8_tpptr[--cmdlist.nused]);
+
while(addrlist.nused > 0)
free(addrlist.uint8_tpptr[--addrlist.nused]);
+
while(relist.nused > 0){
i = --relist.nused;
Strclose(relist.stringpptr[i]);
free(relist.stringpptr[i]);
}
+
while(stringlist.nused>0){
i = --stringlist.nused;
Strclose(stringlist.stringpptr[i]);
@@ -440,8 +439,6 @@ parsecmd(int nest)
okdelim(c);
cmd.re = getregexp(c);
if(ct->cmdc == 's'){
- if (cmd.ctext)
- free(cmd.ctext);
cmd.ctext = newstring();
getrhs(cmd.ctext, c, 's');
if(nextc() == c){
@@ -463,12 +460,8 @@ parsecmd(int nest)
}else if((cmd.ccmd = parsecmd(nest))==0)
panic("defcmd");
} else if(ct->text){
- if (cmd.ctext)
- free(cmd.ctext);
cmd.ctext = collecttext();
} else if(ct->token){
- if (cmd.ctext)
- free(cmd.ctext);
cmd.ctext = collecttoken(ct->token);
} else
atnl();