[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Universal functions to manage multiple window caches.
From: |
Alex Gramiak |
Subject: |
Re: Universal functions to manage multiple window caches. |
Date: |
Fri, 19 Apr 2019 07:59:09 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Keith David Bershatsky <address@hidden> writes:
> I created a minimal working example based upon my interpretation of how to
> use your sample struct. Was it your intention that each main cache would be
> defined as follows (and the MWE being nth 0 below):
>
> 1. TEMP flavor: w->mc_elts[0]
>
> 2. MC flavor: w->mc_elts[1]
>
> 3. CH flavor: w->mc_elts[2]
>
> 4. FC flavor: w->mc_elts[3]
No, my intention was for each flavor to be a different element in the
window struct. It's fine either way, but different elements could have
more descriptive names than an index allows.
> if (BUFFERP (w->contents)
> && !NILP (BVAR (XBUFFER (w->contents), crosshairs)))
> {
> /* Increase the size of the array. */
> if (w->mc_elts_allocated == 0)
> {
> ++w->mc_nelts;
> int old_alloc = w->mc_elts_allocated;
> int new_elts = w->mc_nelts - w->mc_elts_allocated;
> w->mc_elts = xpalloc (w->mc_elts, &w->mc_elts_allocated,
> new_elts, INT_MAX, sizeof *w->mc_elts);
> memset (w->mc_elts + old_alloc, 0,
> (w->mc_elts_allocated - old_alloc) * sizeof *w->mc_elts);
> }
Did you forget to update this part?