9front - general discussion about 9front
 help / color / mirror / Atom feed
From: covertusername967@gmail.com
To: 9front@9front.org
Subject: Re: [9front] libmp and error handling
Date: Sat, 24 Oct 2020 18:52:53 -0500	[thread overview]
Message-ID: <D83DF21805452CD642F40CAA16999ADD@gmail.com> (raw)
In-Reply-To: <1795470027CF8F4349F3EB3E6D25A7EF@eigenstate.org>

> This is still likely to require quite a bit of change in libmp; if
> it's currently calling sysfatal, then it's very likely full of
> things like:
> 
> 	x = a();
> 	y = b()
> 	return mpadd(x, y);
> 
> which means that if b() errors, then x is leaked.

So, I tried changing libmp itself.  It rapidly became a hairy mess of
return checking, and making the library do more allocation just to
preserve the original function arguments.  Instead, here's a patch to
fix the manpage:

diff -r 5a6b0e6ac3b2 sys/man/2/mp
--- a/sys/man/2/mp	Sun Oct 25 00:49:29 2020 +0200
+++ b/sys/man/2/mp	Sat Oct 24 18:51:53 2020 -0500
@@ -287,8 +287,8 @@
 .I mpnew
 and
 .IR mpcopy ,
-will return
-.B nil
+will call sysfatal (see
+.IR perror (2))
 if the allocation fails.
 .PP
 Input and result parameters may point to the same



  reply	other threads:[~2020-10-24 23:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-21  3:56 covertusername967
2020-10-21  4:08 ` Alex Musolino
2020-10-21  4:27   ` covertusername967
2020-10-21 13:53     ` ori
2020-10-24 23:52       ` covertusername967 [this message]
2020-10-25  0:25         ` ori

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=D83DF21805452CD642F40CAA16999ADD@gmail.com \
    --to=covertusername967@gmail.com \
    --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).