FreeBSD/sys/contrib/dev/acpica/compiler/prutils.c
/*******************************************************************************
 *
 * FUNCTION:    PrReplaceData
 *
 * PARAMETERS:  Buffer              - Original(target) buffer pointer
 *              LengthToRemove      - Length to be removed from target buffer
 *              BufferToAdd         - Data to be inserted into target buffer
 *              LengthToAdd         - Length of BufferToAdd
 *
 * RETURN:      None
 *
 * DESCRIPTION: Generic buffer data replacement.
 *
 ******************************************************************************/
PrReplaceData
PARAMETERS:  Buffer              - Original(target) buffer pointer
LengthToRemove      - Length to be removed from target buffer
BufferToAdd         - Data to be inserted into target buffer
LengthToAdd         - Length of BufferToAdd

None

Generic buffer data replacement.
PrReplaceData PARAMETERS : Buffer - Original ( target ) buffer pointer LengthToRemove - Length to be removed from target buffer BufferToAdd - Data to be inserted into target buffer LengthToAdd - Length of BufferToAdd None Generic buffer data replacement .
void
PrReplaceData (
    char                    *Buffer,
    UINT32                  LengthToRemove,
    char                    *BufferToAdd,
    UINT32                  LengthToAdd)
{
    UINT32                  BufferLength;
    BufferLength = strlen (Buffer) + 1;
    if (LengthToRemove != LengthToAdd)
    {
        if (LengthToRemove > 0)
        {
            memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove),
                (BufferLength - LengthToRemove));
        }
    }
    if (LengthToAdd > 0)
    {
        memmove (Buffer, BufferToAdd, LengthToAdd);
    }
}
void PrReplaceData ( char * Buffer , UINT32 LengthToRemove , char * BufferToAdd , UINT32 LengthToAdd ) { UINT32 BufferLength ; BufferLength = strlen ( Buffer ) + 1 ; if ( LengthToRemove != LengthToAdd ) { if ( LengthToRemove > 0 ) { memmove ( ( Buffer + LengthToAdd ) , ( Buffer + LengthToRemove ) , ( BufferLength - LengthToRemove ) ) ; } } if ( LengthToAdd > 0 ) { memmove ( Buffer , BufferToAdd , LengthToAdd ) ; } }
FUNCTION:    PrReplaceData
 PARAMETERS:  Buffer              - Original(target) buffer pointer
              LengthToRemove      - Length to be removed from target buffer
              BufferToAdd         - Data to be inserted into target buffer
              LengthToAdd         - Length of BufferToAdd
FUNCTION : PrReplaceData PARAMETERS : Buffer - Original ( target ) buffer pointer LengthToRemove - Length to be removed from target buffer BufferToAdd - Data to be inserted into target buffer LengthToAdd - Length of BufferToAdd
/* Buffer is a string, so the length must include the terminating zero */ /*
         * Move some of the existing data
         * 1) If adding more bytes than removing, make room for the new data
         * 2) if removing more bytes than adding, delete the extra space
         */ /* Now we can move in the new data */