From: Bruce Korb <bkorb@gnu.org>
To: Rob Browning <rlb@defaultvalue.org>, guile-devel@gnu.org
Subject: Re: [PATCH 1/1] scm_set_source_properties_x: optimize if only name, line, and/or col
Date: Sun, 17 Jan 2021 14:55:53 -0800 [thread overview]
Message-ID: <3a393e11-15b4-6504-47da-aea9e950446d@gnu.org> (raw)
In-Reply-To: <20210117222458.902736-1-rlb@defaultvalue.org>
On 1/17/21 2:24 PM, Rob Browning wrote:
> * libguile/srcprop.c (scm_set_source_properties_x): When only a subset
> of file, line, and column fields are specified, store the data as a
> srcprops object (tc16_srcprops) rather than an alist.
> ---
>
> Proposed for at least 3.x. If we want some additional tests, then
> one option might be a public or private predicate to test for a
> srcprops object (at least for scheme level testing).
Does this mean I can swap out this code for something better now? I've
disliked this code for years.
> static SCM
> ag_scm_c_eval_string_from_file_line(
> char const * pzExpr, char const * pzFile, int line)
> {
> SCM port = scm_open_input_string(AG_SCM_FROM_STR(pzExpr));
>
> if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
> fprintf(trace_fp, TRACE_EVAL_STRING, pzFile, line, pzExpr);
>
> {
> static SCM file = SCM_UNDEFINED;
> static char * pzOldFile = NULL;
>
> if ((pzOldFile == NULL) || (strcmp(pzOldFile, pzFile) != 0)) {
> if (pzOldFile != NULL)
> AGFREE(pzOldFile);
> AGDUPSTR(pzOldFile, pzFile, "scheme source");
> file = AG_SCM_FROM_STR(pzFile);
> }
>
> {
> SCM ln = scm_from_int(line);
> scm_set_port_filename_x(port, file);
> scm_set_port_line_x(port, ln);
> scm_set_port_column_x(port, SCM_INUM0);
> }
> }
>
> {
> SCM ans = SCM_UNSPECIFIED;
>
> /* Read expressions from that port; ignore the values. */
> for (;;) {
> SCM form = scm_read(port);
> if (SCM_EOF_OBJECT_P(form))
> break;
> ans = scm_primitive_eval_x(form);
> }
>
> return ans;
> }
> }
next prev parent reply other threads:[~2021-01-17 22:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-17 22:24 [PATCH 1/1] scm_set_source_properties_x: optimize if only name, line, and/or col Rob Browning
2021-01-17 22:55 ` Bruce Korb [this message]
2021-03-09 20:52 ` Andy Wingo
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a393e11-15b4-6504-47da-aea9e950446d@gnu.org \
--to=bkorb@gnu.org \
--cc=guile-devel@gnu.org \
--cc=rlb@defaultvalue.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 read-only IMAP folder(s) and NNTP newsgroup(s).