GNU libavl 2.0.1
Author: Ben Pfaff

14.5.2 Step 3: Update Balance Factors |

Step 3, updating balance factors, is taken straight from TAVL deletion (see Deleting a TAVL Node Step 3 - Update), with the call to find_parent() replaced by inline code that uses pavl_parent.

    539. <Steps 3 and 4: Update balance factors and rebalance after PAVL deletion 539> =
    while (q != (struct pavl_node *) &tree->pavl_root)
      {
        struct pavl_node *y = q;

        if (y->pavl_parent != NULL)
          q = y->pavl_parent;
        else
          q = (struct pavl_node *) &tree->pavl_root;

        if (dir == 0)
          {
            dir = q->pavl_link[0] != y;
            y->pavl_balance++;
            if (y->pavl_balance == +1)
              break;
            else if (y->pavl_balance == +2)
              {
                <Step 4: Rebalance after PAVL deletion 540>
              }
          }
        else
          {
            <Steps 3 and 4: Symmetric case in PAVL deletion 543>
          }
      }

    tree->pavl_count--;
    return (void *) item;

This code is included in 534.

14.5.1 Step 2: Delete | 14.5 Deletion | 14.5.3 Step 4: Rebalance