Re: [PATCH] Small patch to bloat-o-meter.

From: Matt Mackall
Date: Mon May 08 2006 - 00:53:34 EST


On Mon, May 08, 2006 at 12:43:51AM -0400, Rob Landley wrote:
> On Sunday 07 May 2006 11:02 pm, Matt Mackall wrote:
> > > --- linux-old/scripts/bloat-o-meter 2006-05-07 15:47:23.000000000 -0400
> > > +++ linux-2.6.16/scripts/bloat-o-meter 2006-05-07 15:08:31.000000000
> > > -0400 @@ -18,7 +18,9 @@
> > > for l in os.popen("nm --size-sort " + file).readlines():
> > > size, type, name = l[:-1].split()
> > > if type in "tTdDbB":
> > > - sym[name] = int(size, 16)
> > > + if name.find(".") != -1: name = "static." +
> > > name.split(".")[0]
> >
> > if "." in name:
> >
> > (just like 'if type in "tTdDbB":' above it)
>
> I learned python over 5 years ago and the language has changed out from under
> me a bit. When I've done a lot of C programming recently, I tend to fall
> back on the old ways... :)
>
> > > + if name in sym: sym[name] += int(size, 16)
> > > + else :sym[name] = int(size, 16)
> >
> > else:
>
> I'm surprised that even ran...
>
> > Actually, this probably wants to be:
> >
> > sym.setdefault(name, 0) += int(size, 16)
>
> File "scripts/bloat-o-meter", line 22
> sym.setdefault(name, 0) += int(size, 16)
> SyntaxError: can't assign to function call

Oh, right. That's why I never do that.

sym[name] = sym.get(name, 0) + int(size, 16)

--
Mathematics is the supreme nostalgia of our time.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/