MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / n_insertx

Function n_insertx

dep/hfsutils/libhfs/node.c:346–367  ·  view source on GitHub ↗

* NAME: node->insertx() * DESCRIPTION: insert a record into a node (which must already have room) */

Source from the content-addressed store, hash-verified

344 * DESCRIPTION: insert a record into a node (which must already have room)
345 */
346void n_insertx(node *np, const byte *record, unsigned int reclen)
347{
348 int rnum, i;
349 byte *ptr;
350
351 rnum = np->rnum + 1;
352
353 /* push other records down to make room */
354
355 for (ptr = HFS_NODEREC(*np, np->nd.ndNRecs) + reclen;
356 ptr > HFS_NODEREC(*np, rnum) + reclen; --ptr)
357 *(ptr - 1) = *(ptr - 1 - reclen);
358
359 ++np->nd.ndNRecs;
360
361 for (i = np->nd.ndNRecs; i > rnum; --i)
362 np->roff[i] = np->roff[i - 1] + reclen;
363
364 /* write the new record */
365
366 memcpy(HFS_NODEREC(*np, rnum), record, reclen);
367}
368
369/*
370 * NAME: node->insert()

Callers 3

splitFunction · 0.85
n_insertFunction · 0.85
bt_insertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected