Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] zprof: Don't tally all anonymous functions as though they were a single function named "(anon)".
- X-seq: zsh-workers 45924
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] zprof: Don't tally all anonymous functions as though they were a single function named "(anon)".
- Date: Tue, 26 May 2020 22:15:46 +0000
- In-reply-to: <20200526220638.26711-1-danielsh@tarpaulin.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20200526220638.26711-1-danielsh@tarpaulin.shahaf.local2>
Daniel Shahaf wrote on Tue, 26 May 2020 22:06 +00:00:
> +++ b/Src/Modules/zprof.c
> @@ -213,7 +213,25 @@ bin_zprof(UNUSED(char *nam), UNUSED(char **args),
> @@ -224,12 +242,19 @@ zprof_wrapper(Eprog prog, FuncWrap w, char *name)
> + char *name_for_lookups;
> +
> + if (is_anonymous_function_name(name)) {
> + name_for_lookups = name_for_anonymous_function(name);
> + } else {
> + name_for_lookups = ztrdup(name);
Memory leak when either of the next two conditions is false.
> + }
>
> if (zprof_module && !(zprof_module->node.flags & MOD_UNLOAD)) {
> active = 1;
> - if (!(f = findpfunc(name))) {
> + if (!(f = findpfunc(name_for_lookups))) {
> f = (Pfunc) zalloc(sizeof(*f));
> - f->name = ztrdup(name);
> + f->name = name_for_lookups;
> f->calls = 0;
> f->time = f->self = 0.0;
> f->next = calls;
> Should «funcstack» be checked for NULL before it's dereferenced?
> The funcstack frame is added in doshfunc() while wrappers are called
> from runshfunc(). I don't see any case in which doshfunc() won't have
> been called by the time runshfunc() has, but then I don't completely
> grok the sense of the EF_RUN flag as used in doshfunc().
This question stands.
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author