summaryrefslogtreecommitdiff
path: root/fb/23a8d9de1adf1bb1a71022e28f6388a86e8abb
blob: 4950f30dbadb3276bb55457fac5ac99ab5e28a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
Delivery-date: Tue, 02 Jul 2024 18:30:59 -0700
Received: from mail-yb1-f192.google.com ([209.85.219.192])
	by mail.fairlystable.org with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
	(Exim 4.94.2)
	(envelope-from <bitcoindev+bncBC4YZUEZZIIBBSWTSK2AMGQEMCUXL6I@googlegroups.com>)
	id 1sOopm-0007jb-QZ
	for bitcoindev@gnusha.org; Tue, 02 Jul 2024 18:30:59 -0700
Received: by mail-yb1-f192.google.com with SMTP id 3f1490d57ef6-e035f7b5976sf270661276.0
        for <bitcoindev@gnusha.org>; Tue, 02 Jul 2024 18:30:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlegroups.com; s=20230601; t=1719970252; x=1720575052; darn=gnusha.org;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:references:in-reply-to:message-id:to:from:date:sender:from
         :to:cc:subject:date:message-id:reply-to;
        bh=ENJq+PIOObjJOFd6YWMv22Wq6XZLGTUgViJlswpymnY=;
        b=xh4TfisqXYYDR+r5fLc7gPt9P5LOFedH+PwRjT/sW6PWmlIR4aF95gIT5JtDlBNUSF
         g1QY3UCApvnnDvwtAcXap3seNBX5b3cgAm1Feer7AI1mk0q1VoXrueWH5Vy7pZZS7pP8
         to8RUVOgJ1U656FS9jY+RIR0v8oS8Imkp3xbIyt/Wm6r3y15RJV+7EPUiGfjBBpANXjM
         20u9CVCuOZF/JKgNG+dmykGgrJA2PQb7huDUbYgk96+5qf5GA9U5WS8FwmM5L1S+/EOV
         A3+RFYAqM9twG0xCaEygpDYEJKaTVuhn1zHj8rAAg47pKpoQ/Vm1n1ohL5Qtsk4I5Qa/
         rVXg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1719970252; x=1720575052; darn=gnusha.org;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:references:in-reply-to:message-id:to:from:date:from:to:cc
         :subject:date:message-id:reply-to;
        bh=ENJq+PIOObjJOFd6YWMv22Wq6XZLGTUgViJlswpymnY=;
        b=gQW7ak41AboQl9Q2U3dmbp8FhoZ02Ttk/SFOpGV1r0JDuqwWl+D6ZAR0/3VeQvFoF4
         u7NXZ1bjDz31gK6bDDBg30WZsmeVeXf5E/KQ5TZOG5wj2HSbUv2NJT/6yZvHfjIz0NG/
         1e9khVDw3U5SMYwjUa62ccLFa+IyHWyYINBJdv+33+Z2eKDOxwGjAkBmuaNWY2oIL5j6
         m9281Sm6uW10QLEWfA0ZVAzLEdxNfPOZdDk9x2MUPKxhCGxkBjvAjeqJp4rXesOuKG/i
         LxIau2npU6MqsKE2ggGrJcsMZ4i9OJULu7qEW+bNB6MSLU5ZfFgM/tOGEfHFxcMEeScH
         K3dg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1719970252; x=1720575052;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:references:in-reply-to:message-id:to:from:date:x-beenthere
         :x-gm-message-state:sender:from:to:cc:subject:date:message-id
         :reply-to;
        bh=ENJq+PIOObjJOFd6YWMv22Wq6XZLGTUgViJlswpymnY=;
        b=SYy7FUsDgU8LyvWgdlN5y4W0+04trfiLhJgIunH4UxHbs6gobOnI1x+uQPHF7GRyzL
         T4LjsPz4qXc9aFk5yQS5dBVfIXmR2ja9zt2Xkj5r906qgnDA5qAf8sE1v0xQlVjR3uKO
         ogN0IgSUzyrfupG6cFWejvyG9kSq3B6oJR5ryhXTLvaQFO1HpTXMxkZLY4qaSU2jUD9Z
         t6TrqCLljttlO1Ao/DN9O8AGzPYuy1mfRtpoyJ+ZUoYq8lzaJFBJmP7OaJKWqpfPqvhF
         RMQZx/gh1Tzn+IeO/6lUDoViYNn1ssgV7yh3hcce0uWPcgJljVTXk6T4BUGnJM8ASDiY
         Rahg==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=1; AJvYcCVIIx5UCB3HjYhw92RRp3n6aNYy7XxyjMp3sQdHbvUwASo5Vf+BJt4Qk64KkumhWhX2RFPwAYOzvHG3jJlFK3JfLbCrAkQ=
X-Gm-Message-State: AOJu0YxbImI5pcU2HvhPJGmdX/M6uHa7EzP5j1XJFh2d5w2LU0aX1bNP
	SuLT7/79ZOZ6Hwgw9/BOoSdlpVBJaLUz7yio0zsJEw2W66AjVcPF
X-Google-Smtp-Source: AGHT+IGpL2yPzioFGWrI/3JXXd5bxgUmj1+5zOf6XvRrMx8tXZKh8F7cWFwQA5XdaKD+BcI3+p/0vg==
X-Received: by 2002:a25:9090:0:b0:e03:a504:5c92 with SMTP id 3f1490d57ef6-e03ad9692c5mr137563276.30.1719970252055;
        Tue, 02 Jul 2024 18:30:52 -0700 (PDT)
X-BeenThere: bitcoindev@googlegroups.com
Received: by 2002:a05:6902:722:b0:dfa:77ba:dc1f with SMTP id
 3f1490d57ef6-e0356274b10ls7600763276.2.-pod-prod-06-us; Tue, 02 Jul 2024
 18:30:50 -0700 (PDT)
X-Received: by 2002:a05:6902:2b89:b0:dff:83e:b259 with SMTP id 3f1490d57ef6-e036eb4a8cemr1100341276.6.1719970250443;
        Tue, 02 Jul 2024 18:30:50 -0700 (PDT)
Received: by 2002:a05:690c:4289:b0:63b:c3b0:e1c with SMTP id 00721157ae682-6514011671ams7b3;
        Tue, 2 Jul 2024 18:07:10 -0700 (PDT)
X-Received: by 2002:a05:6902:298e:b0:e03:54e2:4ca2 with SMTP id 3f1490d57ef6-e036eb1b316mr115143276.4.1719968827937;
        Tue, 02 Jul 2024 18:07:07 -0700 (PDT)
Date: Tue, 2 Jul 2024 18:07:07 -0700 (PDT)
From: Larry Ruane <larryruane@gmail.com>
To: Bitcoin Development Mailing List <bitcoindev@googlegroups.com>
Message-Id: <e2c61ee5-68c4-461e-a132-bb86a4c3e2ccn@googlegroups.com>
In-Reply-To: <301c64c7-0f0f-476a-90c4-913659477276n@googlegroups.com>
References: <gnM89sIQ7MhDgI62JciQEGy63DassEv7YZAMhj0IEuIo0EdnafykF6RH4OqjTTHIHsIoZvC2MnTUzJI7EfET4o-UQoD-XAQRDcct994VarE=@protonmail.com>
 <72e83c31-408f-4c13-bff5-bf0789302e23n@googlegroups.com>
 <heKH68GFJr4Zuf6lBozPJrb-StyBJPMNvmZL0xvKFBnBGVA3fVSgTLdWc-_8igYWX8z3zCGvzflH-CsRv0QCJQcfwizNyYXlBJa_Kteb2zg=@protonmail.com>
 <5b0331a5-4e94-465d-a51d-02166e2c1937n@googlegroups.com>
 <yt1O1F7NiVj-WkmnYeta1fSqCYNFx8h6OiJaTBmwhmJ2MWAZkmmjPlUST6FM7t6_-2NwWKdglWh77vcnEKA8swiAnQCZJY2SSCAh4DOKt2I=@protonmail.com>
 <be78e733-6e9f-4f4e-8dc2-67b79ddbf677n@googlegroups.com>
 <jJLDrYTXvTgoslhl1n7Fk9-pL1mMC-0k6gtoniQINmioJpzgtqrJ_WqyFZkLltsCUusnQ4jZ6HbvRC-mGuaUlDi3kcqcFHALd10-JQl-FMY=@protonmail.com>
 <9a4c4151-36ed-425a-a535-aa2837919a04n@googlegroups.com>
 <3f0064f9-54bd-46a7-9d9a-c54b99aca7b2n@googlegroups.com>
 <26b7321b-cc64-44b9-bc95-a4d8feb701e5n@googlegroups.com>
 <CALZpt+EwVyaz1=A6hOOycqFGJs+zxyYYocZixTJgVmzZezUs9Q@mail.gmail.com>
 <607a2233-ac12-4a80-ae4a-08341b3549b3n@googlegroups.com>
 <3dceca4d-03a8-44f3-be64-396702247fadn@googlegroups.com>
 <301c64c7-0f0f-476a-90c4-913659477276n@googlegroups.com>
Subject: Re: [bitcoindev] Re: Great Consensus Cleanup Revival
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_27134_840701207.1719968827654"
X-Original-Sender: LarryRuane@gmail.com
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
 <https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.5 (/)

------=_Part_27134_840701207.1719968827654
Content-Type: multipart/alternative; 
	boundary="----=_Part_27135_537405036.1719968827654"

------=_Part_27135_537405036.1719968827654
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Monday, July 1, 2024 at 11:03:33=E2=80=AFPM UTC-6 Antoine Riard wrote:


Here a snippet example of linked list code checking the pointer=20
(`*begin_list`) is non null before the comparison operation to find the=20
target element list.

```
pointer_t       ft_list_find(pointer_t **start_list, void *data_ref, int=20
(*cmp)())
{
        while (*start_list)
        {
                if (cmp((*start_list)->data, data_ref) =3D=3D 0)
                        return (*start_list);
                *start_list =3D (*start_list)->next;
        }
        return (0);
}
```


I assume this function lets you search for an element starting in the=20
middle of a single-linked list (the middle because you could call=20
`ft_list_find(&p-next, data_ref)` where `p` points to any element in the=20
middle of the list, including possibly the last item in the list, in which=
=20
case the loop body wouldn't run). If so, I don't think this does what's=20
intended. This actually unlinks (and memory-leaks) elements up to where the=
=20
match is found. I think you want to advance `start_list` this way (I didn't=
=20
test this):

```
    start_list =3D &(*start_list)->next;
```

Larry

--=20
You received this message because you are subscribed to the Google Groups "=
Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/=
bitcoindev/e2c61ee5-68c4-461e-a132-bb86a4c3e2ccn%40googlegroups.com.

------=_Part_27135_537405036.1719968827654
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div><div dir=3D"auto">On Monday, July 1, 2024 at 11:03:33=E2=80=AFPM UTC-6=
 Antoine Riard wrote:<br /></div><blockquote style=3D"margin: 0px 0px 0px 0=
.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><=
br />Here a snippet example of linked list code checking the pointer (`*beg=
in_list`) is non null before the comparison operation to find the target el=
ement list.<br /><br />```<br />pointer_t =C2=A0 =C2=A0 =C2=A0 ft_list_find=
(pointer_t **start_list, void *data_ref, int (*cmp)())<br />{<br />=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 while (*start_list)<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 {=
<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (cmp((*sta=
rt_list)-&gt;data, data_ref) =3D=3D 0)<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (*start_list);<=
br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *start_list =
=3D (*start_list)-&gt;next;<br />=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br />=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 return (0);<br />}</div><div>```</div></blockquote><di=
v><br /></div><div>I assume this function lets you search for an element st=
arting in the middle of a single-linked list (the middle because you could =
call `ft_list_find(&amp;p-next, data_ref)` where `p` points to any element =
in the middle of the list, including possibly the last item in the list, in=
 which case the loop body wouldn't run). If so, I don't think this does wha=
t's intended. This actually unlinks (and memory-leaks) elements up to where=
 the match is found. I think you want to advance `start_list` this way (I d=
idn't test this):</div><div><br /></div><div>```</div><div>=C2=A0 =C2=A0 st=
art_list =3D &amp;(*start_list)-&gt;next;</div>```</div><div><br /></div><d=
iv>Larry</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Bitcoin Development Mailing List&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:bitcoindev+unsubscribe@googlegroups.com">bitcoind=
ev+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/bitcoindev/e2c61ee5-68c4-461e-a132-bb86a4c3e2ccn%40googlegroups.=
com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msg=
id/bitcoindev/e2c61ee5-68c4-461e-a132-bb86a4c3e2ccn%40googlegroups.com</a>.=
<br />

------=_Part_27135_537405036.1719968827654--

------=_Part_27134_840701207.1719968827654--