"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: got_errors[]
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 18 Mar 2022 20:53:12 +0100

Download raw body.

Thread
  • Christian Weisgerber:

    got_errors[]

    • Stefan Sperling:

      got_errors[]

On Fri, Mar 18, 2022 at 04:24:00PM +0100, Christian Weisgerber wrote:
> The got_errors[] array, which maps error codes to messages, is
> weirdly placed.
> 
> Currently it is defined as a static variable in include/got_error.h.
> In principle, every compiled file that includes got_error.h will
> get its own private copy of got_errors[].  In practice, the compiler
> will silently drop the table from the generated code if it isn't
> referenced.  And only lib/error.c actually references it.
> 
> I think got_errors[] should move into error.c.  The only reason I
> can think of for it to be in got_errno.h is to serve as a reminder
> to add an error message when adding new error codes, but that seems
> a poor justification for such an oddity.
> 

Fine with me.