On Thu, June 5, 2025 at 2:02 AM, Avnish Chouhan <avn...@linux.ibm.com> wrote: > On 2025-06-04 01:17, Alec Brown wrote: > > On Thu, May 29, 2025 at 6:59 AM, Avnish Chouhan <avn...@linux.ibm.com> > > wrote: > >> On 2025-05-21 18:21, grub-devel-requ...@gnu.org wrote: > [...] > >> > + while (*separator == ' ' || *separator == '\t'); > >> > >> What's the use of this while condition? It may result in an infinite > >> loop... > >> > > > > The purpose of this while loop is to remove any additional spaces or > > tabs > > separating the key from the value. I don't believe this would result in > > an > > infinite loop unless the rest of memory was a space or tab. However, an > > issue > > I do see is we aren't checking if there is a value after removing the > > excess > > spaces and tabs in the loop. I'll fix this. > > Hi Alec, > > In my opinion, if we have any of the given condition evaluates as > 'True', it will be an infinite loop. We are't incriminating the pointer > and we will be in a loop forever if "*separator == ' ' or *separator == > '\t'" evaluates 'True'. >
Hi Avnish, For the loop, we are incrementing the 'separator' pointer but since we are using a do-while loop, it's happening before we check the escape condition of the loop. > If I understood the purpose of this loop correctly, I would do something > like this below: > > while (*separator == ' ' || *separator == '\t') > { > ... > separator++; > } > We could write it this way but we would still need to increment the 'separator' pointer before entering the loop since we just wrote an end of string character where the previous space or tab was. Alec Brown > > Thank you! > > Regards, > Avnish Chouhan _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel