| 403 | |
| 404 | |
| 405 | static 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 | |
| 447 | static SLONG write_bucket(const msgnod* bucket, USHORT length) |
no test coverage detected