SILC_STR_REPLACE

NAME

    #define SILC_STR_REPLACE(unsigned char *data, SilcUInt32 len) ...

DESCRIPTION

Encode the `data' of length of `len' bytes into the buffer, replacing existing data.

If the length of the current data area is equal to `len' the data area is replaced with `data'.

If `len' is longer than the data area, it will be enlarged to fit the `data'. If there is data in the tail area, it will not be replaced, but the buffer is enlarged and the old tail area will be copied to the new tail area, thus preserving any data in the buffer (the data is in effect appended to the current data area).

If `len' is shorter than than the data area, only the bytes in `data' are replaced, and rest are deleted from the data area. The buffer size is also reduced but no other data is lost in the process.

If `len' is 0 but `data' is non-NULL, this will delete all bytes from the current data area. If `data' is NULL this macro has no effect to the buffer.

Use this only for formatting.

     Formatting:  SILC_STR_REPLACE(unsigned char *, SilcUInt32)

EXAMPLE

    Before replacing
    -------------------------
    | head  | 12345 | 67890 |
    -------------------------

    After replacing with 12345XXX (appends)
    ----------------------------
    | head  | 12345XXX | 67890 |
    ----------------------------

    After replacing with YYY (deletes)
    -----------------------
    | head  | YYY | 67890 |
    -----------------------