Introduction
Introduction Statistics Contact Development Disclaimer Help
Remove unnecessary frees. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 6db38896e8c2d17bcd2a3534c26bf507f9614f3c
parent 84b051c7d9d429d3f6dda596a9d01e9a85652c82
Author: Rob King <[email protected]>
Date: Thu, 20 Oct 2016 17:24:29 -0500
Remove unnecessary frees.
Diffstat:
sam/cmd.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
---
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();
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.