Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec8eca0b authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Jakub Pawłowski
Browse files

Remove unused strlcat

Flag: exempt, trivial code deletion
Bug: None
Test: mma -j32
Change-Id: Iafba629692ec02b0fd80a30805647f5ce465129c
parent 86fed914
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -31,7 +31,4 @@ pid_t gettid(void) throw();
/* Copy src to string dst of size siz. */
size_t strlcpy(char* dst, const char* src, size_t siz);

/* Appends src to string dst of size siz. */
size_t strlcat(char* dst, const char* src, size_t siz);

#endif
+0 −36
Original line number Diff line number Diff line
@@ -83,39 +83,3 @@ size_t strlcpy(char* dst, const char* src, size_t siz) {
  return (s - src - 1); /* count does not include NUL */
}
#endif

#if __GLIBC__
/*
 * Appends src to string dst of size siz (unlike strncat, siz is the
 * full size of dst, not space left).  At most siz-1 characters
 * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
 * Returns strlen(src) + MIN(siz, strlen(initial dst)).
 * If retval >= siz, truncation occurred.
 */
size_t strlcat(char* dst, const char* src, size_t siz) {
  char* d = dst;
  const char* s = src;
  size_t n = siz;
  size_t dlen;

  /* Find the end of dst and adjust bytes left but don't go past end */
  while (n-- != 0 && *d != '\0') d++;
  dlen = d - dst;
  n = siz - dlen;

  if (n == 0) return (dlen + strlen(s));

  while (*s != '\0') {
    if (n != 1) {
      *d++ = *s;
      n--;
    }

    s++;
  }

  *d = '\0';

  return (dlen + (s - src)); /* count does not include NUL */
}
#endif
+0 −2
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
  size_t len_to_cpy = dataProvider.ConsumeIntegralInRange<size_t>(0, buf_size);
  strlcpy(reinterpret_cast<char*>(dst_buf),
          reinterpret_cast<char*>(bytes.data()), len_to_cpy);
  strlcat(reinterpret_cast<char*>(dst_buf),
          reinterpret_cast<char*>(bytes.data()), len_to_cpy);

  // Clear out our dest buffer
  free(dst_buf);