[Mesa-dev] [PATCH v2] glsl: Add blob.c---a simple interface for serializing data

Carl Worth cworth at cworth.org
Fri Dec 12 15:30:59 PST 2014


On Fri, Dec 12 2014, Jason Ekstrand wrote:
> Should be MAX2(blob->allocated * 2, blob->size + additional)

Yikes! Yes. That's really embarrassing.

> Something to tuck in the back of your brain in case you have a need to grow
> this datastructure: The above write functions could be generated with three
> invocations of a macro that takes a function name and a type.  That would
> prevent copy-and-paste typos.  For only 3 functions, this probably isn't
> worth it.

An excellent point. And before I sent this out the first time, I
actually sat down to re-write it exactly that way. And just as you
mention here, when I saw that it's only the three read functions that
benefit, (read_string() is special), I decided it's more
readable/maintainable in its current form. But yes, if it grows any, we
can definitely do that. So I can at least capture that idea in a
comment.

> Other than the couple comments here and the alignment thing (different
> e-mail).
>
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

Thanks. I'll catch the missing mention of blob.h in Makefile.sources as
Matt pointed out as well.

And like I said, I think I will just hold onto this patch until landing
some code that uses it. (It's not like there's going to be any
difficulty rebasing it across future changes to Mesa.)

-Carl

PS. Aside from Gmail's whacky quoting/wrapping, would it be easy for you
to omit from code-review emails the parts of the code that you're not
replying to? I'm nervous that I might miss some useful comment when I'm
cutting those pieces out of my replies. Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141212/f5fe1750/attachment.sig>


More information about the mesa-dev mailing list