MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / propagate

Function propagate

src/msgs/build_file.cpp:405–444  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403
404
405static void propagate(msgnod** buckets, msgnod** nodes, ULONG prior_code, ULONG position)
406{
407/**************************************
408 *
409 * p r o p a g a t e
410 *
411 **************************************
412 *
413 * Functional description
414 * Propagate a full bucket upward.
415 *
416 **************************************/
417
418 // Make sure current level has been allocated
419
420 if (!*nodes)
421 {
422 *nodes = *buckets = (msgnod*) malloc((SLONG) MSG_BUCKET);
423 nodes[1] = NULL;
424 }
425
426 // Insert into current bucket
427
428 msgnod* node = (*nodes)++;
429 node->msgnod_code = prior_code;
430 node->msgnod_seek = position;
431
432 // Check for full bucket. If not, we're done
433
434 const msgnod* const end = (msgnod*) ((SCHAR*) *buckets + MSG_BUCKET);
435
436 if (*nodes < end)
437 return;
438
439 // Bucket is full -- write it out, propagate the split, and re-initialize
440
441 position = write_bucket(*buckets, MSG_BUCKET);
442 propagate(buckets + 1, nodes + 1, prior_code, position);
443 *nodes = *buckets;
444}
445
446
447static SLONG write_bucket(const msgnod* bucket, USHORT length)

Callers 1

do_msgsFunction · 0.70

Calls 1

write_bucketFunction · 0.85

Tested by

no test coverage detected