@2005'otsul.net
`libft` source map

`libft` source map

Libft Source Map #

This guide explains every helper shipped with this libft implementation. For each function you will find the name origin, its core responsibility, and the neighboring helpers it usually collaborates with.

Directory Layout #

  • src/char/ – character tests and ASCII case conversions.
  • src/convert/ – numeric/string conversion helpers.
  • src/memory/ – low-level memory manipulation and allocation wrappers.
  • src/string/core/ – foundational string length, copy, and search routines.
  • src/string/builders/ – higher-level string constructors and mappers.
  • src/io/ – file-descriptor output helpers.
  • src/list/ – singly linked-list primitives (reserved for the bonus set).

Character Classification & Case Conversion #

FunctionName meaningPrimary roleWorks closely with
ft_isalphais alpha (alphabetic)Check whether a byte represents an ASCII letter.ft_isalnum, ft_tolower, ft_toupper
ft_isdigitis digitDetect ASCII digits 0-9.ft_isalnum, ft_atoi
ft_isalnumis alphanumericReport if the byte is either alphabetic or numeric.ft_isalpha, ft_isdigit, input validation
ft_isasciiis ASCIIVerify that a byte value is within the 0–127 ASCII range.Character checks, sanitizers
ft_isprintis printableEnsure a byte is printable ASCII (space through ~).ft_isascii, logging utilities
ft_tolowerto lowerConvert an uppercase ASCII letter to lowercase.ft_isalpha, ft_toupper, text normalization
ft_toupperto upperConvert a lowercase ASCII letter to uppercase.ft_isalpha, ft_tolower, case-insensitive compares

Memory Primitives #

FunctionName meaningPrimary roleWorks closely with
ft_memsetmemory setFill a block of memory with the same byte.ft_bzero, buffer initialization
ft_bzero]byte zeroSpecialized memset that writes zeroes.ft_calloc, struct resets
ft_memcpymemory copyCopy bytes between non-overlapping regions quickly.ft_memmove, string builders
ft_memmovec )memory moveCopy bytes safely even when regions overlap.ft_memcpy, in-place edits
ft_memchrmemory char searchFind the first occurrence of a byte in a block.ft_memcmp, parsers
ft_memcmpmemory compareCompare two byte sequences lexicographically.Sorting helpers, equality checks
ft_calloccontiguous allocAllocate zero-filled memory for an array.ft_bzero, ft_split, ft_strdup

Numeric Conversion #

FunctionName meaningPrimary roleWorks closely with
ft_atoiASCII to integerParse a string as a int, handling whitespace and sign.ft_isdigit, configuration loading
ft_itoainteger to ASCIIRender an int into a newly allocated decimal string.ft_strlen, output formatting

Core String Utilities #

FunctionName meaningPrimary roleWorks closely with
ft_strlenstring lengthCount bytes up to the terminating '\0'.Bounds checks, ft_strlcpy, ft_strlcat
ft_strlcpystring length copyCopy to a sized buffer with null-termination awareness.ft_strlen, safe buffer writes
ft_strlcatstring length concatenateAppend to a sized buffer while tracking the resulting length.ft_strlen, ft_strlcpy, buffer sizing
ft_strchrstring characterLocate the first occurrence of a char in a string.ft_strrchr, tokenizers
ft_strrchrstring reverse characterLocate the last occurrence of a char in a string.ft_strchr, path parsing
ft_strncmpstring compare (n)Compare at most n characters lexicographically.Sorting, prefix checks
ft_strnstrstring find (n)Search for a substring within a bounded length.Parsers, token detection
ft_strdupstring duplicateAllocate and copy a C string.ft_strlen, ft_strlcpy, memory-managed clones

Higher-Level String Builders #

FunctionName meaningPrimary roleWorks closely with
ft_strjoinstring joinConcatenate two strings into a freshly allocated result.ft_strlen, ft_strlcpy, ft_strlcat
ft_strtrimc)string trimRemove a set of characters from both ends of a string.ft_strchr, ft_substr, ft_strlen
ft_substrsubstringExtract a segment of a string starting at an index.ft_strlen, ft_strlcpy, ft_split
ft_splitsplitBreak a string on a delimiter into a NULL-terminated array.ft_substr, ft_calloc, ft_strlen
ft_strmapic)string map indexedBuild a new string by applying a function to each char with index.ft_strlen, ft_striteri
ft_striteristring iterate indexedApply a callback to each char in-place, passing the index.ft_strmapi, mutation helpers

File-Descriptor Output Helpers #

FunctionName meaningPrimary roleWorks closely with
ft_putchar_fdput char (fd)Write a single character to a file descriptor.ft_putstr_fd, low-level logging
ft_putstr_fdput string (fd)Send a null-terminated string to a descriptor.ft_strlen, ft_putendl_fd
ft_putendl_fdput endline (fd)Print a string followed by a newline.ft_putstr_fd, shell-like outputs
ft_putnbr_fdput number (fd)Render an integer as text to a descriptor.ft_itoa, ft_putchar_fd

Linked List Helpers #

FunctionName meaningPrimary roleWorks closely with
ft_lstnewlst β†’ list, new β†’ allocateCreate a fresh node with user content; leaves next as NULL.ft_lstadd_front, ft_lstadd_back, ft_lstmap
ft_lstadd_frontadd node to front of listPrepend a node in O(1) time by rewiring the head pointer.ft_lstnew, ft_lstdelone, user-managed head pointer
ft_lstadd_backadd node to back of listAppend a node at the tail, allocating traversal time as needed.ft_lstlast, ft_lstnew, ft_lstmap
ft_lstlastfetch last list nodeWalk to the final node so callers can append or inspect the tail.ft_lstadd_back, tail-aware user code
ft_lstsizelist sizeCount nodes by linear traversal; useful for diagnostics or loops.Any iterator that needs bounds or validation
ft_lstdelonedelete one list nodeFree a single node (and optionally its payload) once it is unlinked.ft_lstclear, user code removing nodes
ft_lstclearclear listRepeatedly delete nodes, leaving the head pointer empty (NULL).ft_lstdelone, ft_lstmap error handling
ft_lstiteriterate listVisit each node and apply a side-effect function to its content.Any transformation pipeline or printer
ft_lstmapmap list β†’ new listBuild a new list by transforming each content; cleans up on failure.ft_lstnew, ft_lstadd_back, ft_lstclear

How These Pieces Fit Together #

  1. Raw data handling
    Memory primitives (ft_mem*, ft_calloc, ft_bzero) give deterministic control over buffers, setting the stage for every higher-level routine.

  2. Validation and parsing
    Character checks (ft_is*, ft_to*) and numeric conversions (ft_atoi, ft_itoa) let you sanitize input before feeding strings into more complex builders or data structures.

  3. String assembly line
    Core string utilities measure, copy, or locate data. Builders such as ft_split and ft_strtrim compose those basics to reshape text while relying on safe allocation helpers.

  4. Presentation
    The ft_put* family turns your processed data into output directed at any file descriptorβ€”standard output, logs, or sockets.

  5. Linked data structures
    The ft_lst* suite layers allocation, traversal, and cleanup so you can map, filter, or tear down linked lists without leaks, reusing callbacks (del, f) from the other modules.