/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2026-present Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** USBX Component                                                        */
/**                                                                       */
/**   Utility                                                             */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/


/* Include necessary system files.  */

#define UX_SOURCE_CODE

#include "ux_api.h"


/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _ux_utility_string_length_get                       PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Chaoqiong Xiao, Microsoft Corporation                               */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function derives the length of a NULL-terminated string.       */
/*                                                                        */
/*    This function is deprecated, for the possible issue of operating on */
/*    a buffer that is not NULL-terminated. As a replacement,             */
/*    _ux_utility_string_length_check should be used, where the length of */
/*    the buffer is introduced to validate the string by checking for the */
/*    NULL-terminator within the buffer length.                           */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    string                                Pointer to string             */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    length of string                                                    */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    USBX Components                                                     */
/*                                                                        */
/**************************************************************************/
ULONG  _ux_utility_string_length_get(UCHAR *string)
{

ULONG       length =  0;

    /* Loop to find the length of the string.  */
    length =  0;
    while (string[length])
    {

        /* Move to next position.  */
        length++;
    }

    /* Return length to caller.  */
    return(length);
}

