fmemcmpi(3)

πŸ“¦
version 0.7.D001 Β· 2 versions
  • 0.7.D001 Β· debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.7 Β· alpine 3.24, nixpkgs unstable
, in debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– fmemcmpi(3) πŸ’–

okay bestie, this one lives in the Library Functions Manual section of the man pages, and it's genuinely such a slay little function. let's get into it 🫢


✨ NAME ✨

fmemcmpi β€” fuzzy comparison of two memory areas πŸ¦‹


🌸 SYNOPSIS 🌸

#include <fstrcmp.h>
#define FSTRCMPI_IDENTICAL
#define FSTRCMPI_THRESHOLD
#define FSTRCMPI_ERROR
int fmemcmpi(const void *data1, size_t size1, const void *data2, size_t
     size2);

πŸ’… DESCRIPTION πŸ’…

The fmemcmpi() function compares the two memory areas β€” that's the size1 bytes pointed to by data1, and the size2 bytes pointed to by data2. that's it. that's the whole vibe. two blobs of memory, walkin' into a comparison like πŸ‘‘βœ¨


πŸŽ€ RETURN VALUE πŸŽ€

fmemcmpi hands you back an int value somewhere between 0 and FSTRCMPI_IDENTICAL. let's break down the scale, bestie:

  • a value of 0 means the memory areas are utterly unalike πŸ’€ not even a little bit matching.
  • a value of FSTRCMPI_IDENTICAL means the memory areas are identical β€” full match, main character energy, ate and left no crumbs. πŸ”₯
  • a value of more than FSTRCMPI_THRESHOLD (and heads up, that threshold lies between 0.0 and FSTRCMP_IDENTICAL) would be considered "similar" by most people. so like, not identical-identical, but close enough that a human would be like "yeah those are the same thing basically". πŸ™ˆ

and then there's the sad path:

  • a value of FSTRCMPI_ERROR (which is always negative) indicates a malloc(3) failure. not the vibe. memory said no. 😭

πŸ¦‹ SEE ALSO πŸ¦‹


fstrcmp version 0.7 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au>

The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7.

Copyright (C) 1988-2009 Free Software Foundation


and that's the whole page, bestie πŸ’– it's fmemcmpi(3) from fstrcmp version 0.7, brought to you by Peter Miller and a whole lineage of fuzzy-comparison ancestors, and that footer energy is giving 2009 in the best way. go compare some memory, you've got this. periodt. πŸ‘‘βœ¨πŸŽ€