mplist_put(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ mplist_put ✨

ok so bestie, welcome to the mplist_put(3m17n) page πŸ’– this one lives in The m17n Library and it's lowkey one of those functions that does exactly what it says on the tin. let's get into it 🫢


🌸 NAME 🌸

mplist_put β€” the one where you set a property's value in a property list (yes, the original page literally just leaves the dash hanging there, no cap, so here we are πŸ’…)


πŸŽ€ SYNOPSIS πŸŽ€

MPlist* mplist_put (MPlist * plist, MSymbol key, void * val)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, main character behaviour: set the value of a property in a property list ✨

Here's the tea β˜• β€” mplist_put() searches the property list plist from the beginning looking for a property whose key is key:

  • If such a property is found, its value is changed to value. 🎯
  • Otherwise, a brand new property whose key is key and value is value is appended at the end of plist. 🫢
heads up bestie 🚨 β€” go read the documentation of mplist_add() for the restriction on key and val. that restriction is not optional, it's giving rules-are-rules πŸ’€

Also, important detail: if key is a managing key, then val must be a managed object. In that case:

  • the reference count of the old value, if not NULL, is decremented by one πŸ’€
  • and the reference count of val is incremented by one πŸ”₯

so yeah, refcounts are getting shuffled around, stay aware ✨


πŸ’œ RETURN VALUE πŸ’œ

  • If the operation was successful, mplist_put() returns a sublist of plist whose first element is the just modified or added one. slay. πŸ‘‘
  • Otherwise, it returns NULL. 😭

Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


and that's the whole page, bestie πŸŽ€ Version 1.8.4, dated Mon Sep 25 2023 β€” go forth and set those properties, you absolute icon πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from