This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 1/5] Add helper functions check_for_flags and check_for_flags_vqcs
- From: Philippe Waroquiers <philippe dot waroquiers at skynet dot be>
- To: Simon Marchi <simark at simark dot ca>, gdb-patches at sourceware dot org
- Date: Fri, 18 May 2018 23:42:21 +0200
- Subject: Re: [RFC 1/5] Add helper functions check_for_flags and check_for_flags_vqcs
- Ironport-phdr: 9a23:SI7A2x0qvc3OU9CzsmDT+DRfVm0co7zxezQtwd8ZseITK/ad9pjvdHbS+e9qxAeQG9mDsLQc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPbQhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLmizoJOT4n/m/ZiMNwgr5UrhWuqBJw2IPUfIOYOeBicq7HYd8XR2xMVdtRWSxbBYO8apMCAfABPeZZq4n9pkMOrQOgCgKxBOzg0CVIhnjv3a0n0uQuDxvG3Bc9FN8JqHTUrNT1NKMTUeCt1KnH0y/Pbv1M1jfn74jIaw0hofCSUrJqasrc0lIvFwDFj1WWt4PlIymZ2f8TvGWC6edrSOGhi3Y/pg1svjSiwt0ghpTHi44J0FzI6Dt1zYcvKdGmRkN3f9ipG4ZKuS6ALYt5WMYiTnltuCY917IJp4a2fDMPyJQ73x7fbOGHc5SQ7hLjSumRJTB4iWpgeL2inxqy8E6gxfPgVsSszVpGsi5InsPRun0DyxDf8NWLRuV880u7xzqC2R7f5vlBIU8ulKrbL5AhwqQ3lpoWqUnDBi/2mETyjK+XbkUk4van5/7pY7r8vJ+cMJZ0ihz/MqswgMy/Gv81MhMNX2mb/+SzyqHj8VfiT7pUlvE2iLXWsIjGJcQHoa60GxRV0ocm6xmlFTem088VnWIGLFJAYh2HlYvpN0vSL//iFf2/mUijkC93x/DaOb3sGprNIWXYn7v4ZbZy8VJcxxYzzd9B/JJZEaoBIPXuWk/rqNPXEBE4PBauw+n5Etl90ZkeWW3cSpOeZZjTtFiOrscmOeKMZcdBozf4IuImz+XviHYjmhkWdP/tlZQbYjWgF+htI0iCSWHrn80KHHgDpAd4S/bl23OYVjsGX3azW6Mk/jxzN4u8Cp7eR423m/TVxCe6GpxOfm0AFVmWFm71doieQN8XazOUL9MnmDFSBuvpcJMoyRz77Fyy8LFgNOeBoiA=
- References: <20180505192804.12731-1-philippe.waroquiers@skynet.be> <20180505192804.12731-2-philippe.waroquiers@skynet.be> <0a630fc9-18bd-6d3b-5558-9a0389c64d4f@simark.ca>
On Thu, 2018-05-17 at 21:22 -0400, Simon Marchi wrote:
> > + /* First set the flags_counts to 0. */
> > + {
> > + const char *f = flags;
> > + while (*f)
> > + {
> > + flags_counts[f - flags] = 0;
> > + f++;
> > + }
> > + }
>
> What about something like
>
> memset (flags_count, 0, sizeof (flags_count[0]) * strlen (flags));
The code initialising the flags_counts is somewhat similar in structure
to the code that increments the flags_counts.
So, it looks more clear to me to have the zero-ing code and
the incrementing code looking like each other.
But if for gdb, using memset is the typical pattern to zero
an array of int, fine for me.
What do you think ?
Philippe