SAFE_ADD_ID_TO_LIST(3)
π safe_add_id_to_list β the SAFE_ADD_ID_TO_LIST(3) glow-up π
okay bestie, so this is a page from section 3 of the manual (that's the library-functions girlies), and it's literally just two little functions whose whole job is adding ids to a list. no cap, that's it. but they do it safely, which is the whole vibe β¨
π¦ NAME
safe_add_id_to_list,safe_add_id_range_to_listβ add an id, or a whole range of ids, to the list π
πΈ SYNOPSIS
#include "safe_id_range_list.h"
struct safe_id_range_list;
typedef struct safe_id_range_list safe_id_range_list;
int safe_add_id_to_list(safe_id_range_list list, id_t id);
int safe_add_id_range_to_list(safe_id_range_list list, id_t min_id, id_t
max_id);
so yes, you include "safe_id_range_list.h", the struct is an opaque-ish struct safe_id_range_list with a typedef so you don't have to type struct every single time (we love a convenience king π), and then you've got your two little adders up there βοΈ
π₯ DESCRIPTION
safe_add_id_to_list adds a single id to list. one id. that's the whole plot. iconic, minimal, no notes π«Ά
safe_add_id_range_to_list adds a range of ids to list. and here's the rule, bestie, listen up: the min_id must be less than or equal to max_id. that's not a suggestion, that's the law π
π Parameters
- list β the
safe_id_range_listyou're adding values to. it must be non-NULL β like, fr fr, do not hand this a NULL, that's not the move π - id β the id you wanna add. that's it, that's the arg π
- min_id, max_id β the range of ids to add. and again, because we don't play around here: the min_id must be less than or equal to the max_id β
β¨ RETURN VALUE
returns 0 on success and -1 on failure, with errno set appropriately. so like, 0 = slay, -1 = check your errno, bestie, it's gonna tell you what went wrong π
π ERRORS
EINVALβ the list parameter wasNULL, or, insafe_add_id_range_list, min_id was greater than max_id. yeah. that's the "you did the thing" error πENOMEMβ failed to allocate memory. the memory said no π«
π§ AUTHOR
James A. Kupsch β the legend who wrote all this π (we stan)
π SEE ALSO
and if you want more of this energy:
http://research.cs.wisc.edu/mist/safefile
okay that's the whole page, you ate that π½οΈβ¨ this was SAFE_ADD_ID_TO_LIST(3), dated 2011-07-26 β a certified classic, still serving looks on section 3 π π
π¦ where this page comes from
- nixos 26.05: safefile 1.0.5
- nixpkgs unstable: safefile 1.0.5
- Copyright 2007-2008, 2011 James A. Kupsch
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms