Path: blob/main/system/lib/llvm-libc/src/string/strcat.cpp
6175 views
//===-- Implementation of strcat ------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "src/string/strcat.h"9#include "src/__support/macros/config.h"10#include "src/__support/macros/null_check.h"11#include "src/string/string_utils.h"1213#include "src/__support/common.h"1415namespace LIBC_NAMESPACE_DECL {1617LLVM_LIBC_FUNCTION(char *, strcat,18(char *__restrict dest, const char *__restrict src)) {19LIBC_CRASH_ON_NULLPTR(dest);20LIBC_CRASH_ON_NULLPTR(src);21size_t dest_length = internal::string_length(dest);22size_t i;23for (i = 0; src[i] != '\0'; ++i)24dest[dest_length + i] = src[i];2526dest[dest_length + i] = '\0';27return dest;28}2930} // namespace LIBC_NAMESPACE_DECL313233