9front - general discussion about 9front
 help / color / mirror / Atom feed
From: "Steve Simon" <steve@quintile.net>
To: 9front@9front.org
Subject: Re: [9front] sam input line length limits
Date: Sat, 13 Feb 2021 16:25:23 +0000	[thread overview]
Message-ID: <2d5ba311e52f92be0cd5574c95bab7aa@quintile.net> (raw)
In-Reply-To: <10CE4A9EC513CE5FC11B0B0D5006E7C8@eigenstate.org>

Normally I would be very wary of changing sam it has served
me well for many years, but I am with you on this one,
it has bitten me in the past and its annoying.

Re the patch:

I am being pedantic, I know, but for completeness...
free(c) should come before the test for s == nil,
as it could lead to a memory leak. reordering the code
fractionally fixes it.

 
 	c = Strtoc(&f->name);
-	sprint(buf, "%c%c%c %s\n", " '"[f->mod],
+	s = smprint("%c%c%c %s\n", " '"[f->mod],
 		"-+"[f->rasp!=0], " ."[f==curfile], c);
+	if(s == nil)
+		error(Etoolong);
 	free(c);

changes to 

 	c = Strtoc(&f->name);
-	sprint(buf, "%c%c%c %s\n", " '"[f->mod],
+	s = smprint("%c%c%c %s\n", " '"[f->mod],
 		"-+"[f->rasp!=0], " ."[f==curfile], c);
 	free(c);
+	if(s == nil)
+		error(Etoolong);


  parent reply	other threads:[~2021-02-13 16:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-13  0:45 sl
2021-02-13  2:47 ` Nick Owens
2021-02-13  3:43 ` ori
2021-02-13  3:55   ` sl
2021-02-13 16:25   ` Steve Simon [this message]
2021-02-13 20:06     ` ori
2021-02-13 20:21       ` Stanley Lieber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d5ba311e52f92be0cd5574c95bab7aa@quintile.net \
    --to=steve@quintile.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).