On Tue, Oct 24, 2017 at 12:16:47AM -0400, Programmingkid wrote:
>
> > On Oct 22, 2017, at 1:33 AM, David Gibson
> > wrote:
> >
> > On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
> >> On 10/20/2017 10:55 AM, John Arbuckle wrote:
> >>> +static inline size_t strnlen(const char
> On Oct 22, 2017, at 1:33 AM, David Gibson wrote:
>
> On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
>> On 10/20/2017 10:55 AM, John Arbuckle wrote:
>>> +static inline size_t strnlen(const char *string, size_t max_count)
>>> +{
>>> +size_t count;
>>> +for (count = 0;
> On Oct 22, 2017, at 3:06 PM, Ian Lepore wrote:
>
> On Sun, 2017-10-22 at 10:41 -0400, Programmingkid wrote:
>>>
>>> On Oct 22, 2017, at 1:33 AM, David Gibson wrote:
>>>
>>> On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
On 10/20/2017 10:55 AM, John Arbuckle wr
On Sun, 2017-10-22 at 10:41 -0400, Programmingkid wrote:
> >
> > On Oct 22, 2017, at 1:33 AM, David Gibson wrote:
> >
> > On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
> > >
> > > On 10/20/2017 10:55 AM, John Arbuckle wrote:
> > > >
> > > > +static inline size_t strnlen(co
... this one is even smaller. Plus it uses the familiar strlen() function:
size_t strnlen(const char *string, size_t max_count)
{
return strlen(string) < max_count ? strlen(string) : max_count;
}
Please do not use that implementation.
The major goal of strnlen is to avoid looking beyond
> On Oct 22, 2017, at 1:33 AM, David Gibson wrote:
>
> On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
>> On 10/20/2017 10:55 AM, John Arbuckle wrote:
>>> +static inline size_t strnlen(const char *string, size_t max_count)
>>> +{
>>> +size_t count;
>>> +for (count = 0;
> On Oct 22, 2017, at 9:37 AM, Peter Maydell wrote:
>
> On 21 October 2017 at 00:44, Richard Henderson
> wrote:
>> On 10/20/2017 10:55 AM, John Arbuckle wrote:
>>> +static inline size_t strnlen(const char *string, size_t max_count)
>>> +{
>>> +size_t count;
>>> +for (count = 0; count <
On 21 October 2017 at 00:44, Richard Henderson
wrote:
> On 10/20/2017 10:55 AM, John Arbuckle wrote:
>> +static inline size_t strnlen(const char *string, size_t max_count)
>> +{
>> +size_t count;
>> +for (count = 0; count < max_count; count++) {
>> +if (string[count] == '\0') {
>>
On Fri, Oct 20, 2017 at 04:44:58PM -0700, Richard Henderson wrote:
> On 10/20/2017 10:55 AM, John Arbuckle wrote:
> > +static inline size_t strnlen(const char *string, size_t max_count)
> > +{
> > +size_t count;
> > +for (count = 0; count < max_count; count++) {
> > +if (string[coun
On 10/20/2017 10:55 AM, John Arbuckle wrote:
> +static inline size_t strnlen(const char *string, size_t max_count)
> +{
> +size_t count;
> +for (count = 0; count < max_count; count++) {
> +if (string[count] == '\0') {
> +break;
> +}
> +}
> +return count;
Prior the Mac OS 10.7, the function strnlen() was not available. This patch
implements strnlen() on Mac OS X versions that are below 10.7.
Signed-off-by: John Arbuckle
---
v2 changes:
- Simplified the code to make it static inline'ed
- Changed the type of count to size_t
libfdt/libfdt_env.h | 2
11 matches
Mail list logo