From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Re: Universal functions to manage multiple window caches. Date: Fri, 19 Apr 2019 07:59:09 -0600 Message-ID: <87pnpi85aq.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="791"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 19 16:04:19 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHU7n-0018J8-Jg for ged-emacs-devel@m.gmane.org; Fri, 19 Apr 2019 16:04:19 +0200 Original-Received: from localhost ([127.0.0.1]:56951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHU7m-0003mz-G4 for ged-emacs-devel@m.gmane.org; Fri, 19 Apr 2019 10:04:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHU7c-0003kQ-RI for emacs-devel@gnu.org; Fri, 19 Apr 2019 10:04:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHU2n-0003ma-Cd for emacs-devel@gnu.org; Fri, 19 Apr 2019 09:59:10 -0400 Original-Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:33147) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hHU2n-0003ky-3T for emacs-devel@gnu.org; Fri, 19 Apr 2019 09:59:09 -0400 Original-Received: by mail-pf1-x42f.google.com with SMTP id h5so2631702pfo.0 for ; Fri, 19 Apr 2019 06:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=k7Qo6mGdS0dCHDx/oB6v+bMq+QwCz71rp+QCsxzZ6gE=; b=amAHT527NL7I06/xqjTlSBwGz+t6vMj4/mbuWYHmfeCc/lDveE/DrZWry7h6PRtmgK O/WOBqJExB4Ks1+biJnNxaYWvZ9NdtmxejJ08Dt3AQV1BCu3LQMCDUMaq/dbN45rgMVr 0gNzDbfI1Y91H2MICndLM6yYIf3OxpTdDF6WrJ0XnrLPp/FTcD4VNcxkv2xdaFW6l1U1 0WMo/bzeYe8qpgJ+2x4QdM7wyLxCkHbC56y8kPJNPWjnPXk/yXTfWjJHKMKk5UFoZSP1 wQEIej4rCRHLYpOgGiK3lGoT+ewx+9HlaWluJ8qmzrI78MLcZGgxQuQhKHxzdkgi2WdF IELA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=k7Qo6mGdS0dCHDx/oB6v+bMq+QwCz71rp+QCsxzZ6gE=; b=rTvDju3BS5ouzPWdm7h9xGGz4M5x9qaU5XOs4/rIxECzJJCRzuqlZ2fmAeHJ+HB2+d CDR1vftIOHe2ch8Qs+pW8UcsWi862cxDDdMIdxplzX9sq8cAqtsh6Kzqeo9lF6+YBD2z pK8QiSbAxyrANYVrSmXudDl/3/5gaDJP4If+6kh6ENqDjj/J6HZPjY4Y/Ml+q8elB0s1 jTzS8YWUUDS1KelZhJ+rcWwkPyyYMXbYoXyBdtC+snlB4nrtLdCG/otUnSlT3YHrLvEl lMpRcxDIOIhLtxondb+Do7bWNd0dBq0pRfHYFY+EZGfUtpmtiLGxB1HhdLe4L8MkxXm5 rWzA== X-Gm-Message-State: APjAAAUpCfG27EO3jc8IB9Vr1ALjyMK5vFEjLRrXekBTIZO3Kb233lpW pd2/XbTS1Y01looN0k2JGWFIYsk6 X-Google-Smtp-Source: APXvYqwXSoobsbFScVDYRJev4LCRU9DDjhmg7BH3OHAIAtKIrvvy7hgNnr5UQKiLtpXY8odQbR7Azg== X-Received: by 2002:aa7:8552:: with SMTP id y18mr4017148pfn.176.1555682347963; Fri, 19 Apr 2019 06:59:07 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id 6sm7494635pft.64.2019.04.19.06.59.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Apr 2019 06:59:07 -0700 (PDT) In-Reply-To: (Keith David Bershatsky's message of "Thu, 18 Apr 2019 18:44:59 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::42f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235657 Archived-At: Keith David Bershatsky 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?