gif: Simplify LZW clear code handling

The existing code had a special state for handling codes after a clear code was
received. This is more simply handled by using the 'lzw_oldcode' variable. This
makes code that is less likely to introduce errors.
2 jobs for gif-fixes in 4 minutes (queued for 1 second)
Status Job ID Name Coverage
  Build
passed #188903
meson-fedora-x86_64

00:03:01

passed #188904
win32
msys2-mingw64

00:03:58