File:  [Local Repository] / solidite / libc / string.c
Revision 1.1: download - view: text, annotated - select for diffs
Tue Sep 8 00:37:30 2026 UTC (11 days, 2 hours ago) by user
CVS tags: MAIN, HEAD
Initial revision

/* Copyright (c) 2026 The Solidite Developers
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>. */

#include "include/string.h"

void *memcpy(void *restrict dest, const void *restrict src, size_t n) {
  char *d = (char *)dest;
  const char *s = (const char *)src;

  for (size_t i = 0; i < n; ++i) {
    d[i] = s[i];
  }
  return dest;
}

size_t strlen(const char *s) {
  size_t ret = 0;
  while (*s != '\0')
    ++ret;
  return ret;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>