[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: buffer.c/buffer.h: How to add new buffer-local variables?

From: Eli Zaretskii
Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables?
Date: Wed, 03 Apr 2019 20:43:49 +0300

> Date: Tue, 2 Apr 2019 11:46:22 -0700
> From: "Daniel Colascione" <address@hidden>
> Cc: "Daniel Colascione" <address@hidden>,
>  address@hidden
> > The comment says "sanity check", but I would like to understand what
> > kind of sanity is being checked here, and what should be done when
> > some structure we dump becomes larger than this value.  E.g., is there
> > some other limit that requires that offsets of dumped fields never
> > exceed 1024 here?  I'd like to document in comments what to do when
> > the assertion is violated.
> Indeed. That comment could have been a lot better. The general idea here
> is this:
> When we enter field_relpos, we're in the middle of some code that's
> dumping some data structure field-by-field. The object that we're dumping
> begins at in_start; and in_field is an interior pointer into that object.
> We can't actually check that the two pointers refer to the same object: C
> doesn't give us that level of introspection. But if the two pointers point
> to addresses that differ by a lot, then the two pointers probably don't
> refer to the same object, and in this case, we can fail an assertion. 1024
> is probably too conservative here. We probably want to greatly increase
> this number (say, to 32k) and also to give it a named constantly, maybe

Thanks, I went with a smaller value, 2KB.  It should be good enough
for now, as the largest object is slightly below 1KB.

> Note that this limit doesn't apply to big variable-length structures like
> vectors: we dump these element-by-element instead of treating the whole
> thing as one big "object" with a large and variable number of fields.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]