[1] | 1 | /* $Id: strlen.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
| 2 | /** @file
|
---|
[8245] | 3 | * IPRT - CRT Strings, strlen().
|
---|
[1] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[1] | 8 | *
|
---|
[96407] | 9 | * This file is part of VirtualBox base platform packages, as
|
---|
| 10 | * available from https://www.virtualbox.org.
|
---|
[5999] | 11 | *
|
---|
[96407] | 12 | * This program is free software; you can redistribute it and/or
|
---|
| 13 | * modify it under the terms of the GNU General Public License
|
---|
| 14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
| 15 | * License.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful, but
|
---|
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 20 | * General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
| 24 | *
|
---|
[5999] | 25 | * The contents of this file may alternatively be used under the terms
|
---|
| 26 | * of the Common Development and Distribution License Version 1.0
|
---|
[96407] | 27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
| 28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
[5999] | 29 | * CDDL are applicable instead of those of the GPL.
|
---|
| 30 | *
|
---|
| 31 | * You may elect to license modified versions of this file under the
|
---|
| 32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
[96407] | 33 | *
|
---|
| 34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
[1] | 35 | */
|
---|
| 36 |
|
---|
| 37 |
|
---|
[57358] | 38 | /*********************************************************************************************************************************
|
---|
| 39 | * Header Files *
|
---|
| 40 | *********************************************************************************************************************************/
|
---|
[96043] | 41 | #include "internal/iprt.h"
|
---|
[1] | 42 | #include <iprt/string.h>
|
---|
| 43 |
|
---|
| 44 |
|
---|
| 45 | /**
|
---|
| 46 | * Find the length of a zeroterminated byte string.
|
---|
| 47 | *
|
---|
| 48 | * @returns String length in bytes.
|
---|
| 49 | * @param pszString Zero terminated string.
|
---|
| 50 | */
|
---|
[96043] | 51 | #ifdef IPRT_NO_CRT
|
---|
| 52 | # undef strlen
|
---|
[96045] | 53 | size_t RT_NOCRT(strlen)(const char *pszString)
|
---|
[96043] | 54 | #elif RT_MSC_PREREQ(RT_MSC_VER_VS2005)
|
---|
[1] | 55 | __checkReturn size_t __cdecl strlen(__in_z const char *pszString)
|
---|
| 56 | #else
|
---|
| 57 | size_t strlen(const char *pszString)
|
---|
| 58 | #endif
|
---|
| 59 | {
|
---|
[85075] | 60 | const char *psz = pszString;
|
---|
[1] | 61 | while (*psz)
|
---|
| 62 | psz++;
|
---|
| 63 | return psz - pszString;
|
---|
| 64 | }
|
---|
[96043] | 65 | RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strlen);
|
---|
[1] | 66 |
|
---|