#include #include #include #include "UDFCDF_Str.h" #include "UDFCDF_Ansi.h" void ChkStoreMem (ByTe_2 Part, ByTe_2 V) { extern struct WorkArea Wa; ByTe_4 B; switch (Part) /* switch on what to chk */ { /* BEGIN SIZE CHK SWITCH */ case 1: /* START ONEBYTE CASE */ B = V + Wa.NextCStore - Wa.SizeCStore; /* space needed */ if (B > 0) /* need more memory? */ { /* BEGIN MEMEORY GET */ if (Wa.CStore == 0) /* no memory at all */ { /* BEGIN FIRST MEM GET */ if (B < 1024) B = 1024; /* min 1024 1st malloc */ } /* END FIRST MEM GET */ else /* not first malloc */ if (B < 256) B = Wa.SizeCStore + 256; /* min 256 byte inc */ if ((Wa.CStore = realloc (Wa.CStore, B)) == 0) /* get memory */ exit (-1); /* out if err */ Wa.SizeCStore = B; /* reset bytes malloced */ } /* END MEMEORY GET */ break; /* STOP ONEBYTE CASE */ case 2: /* START TWOBYTE CASE */ B = V + Wa.NextSStore - Wa.SizeSStore; /* space needed */ if (B > 0) /* need more memory? */ { /* BEGIN MEMEORY GET */ if (Wa.SStore == 0) /* no memory at all */ { /* BEGIN FIRST MEM GET */ if (B < 128) B = 128; /* min 128 1st malloc */ } /* END FIRST MEM GET */ else /* not first malloc */ if (B < 32) B = Wa.SizeSStore + 32; /* min 32 element inc */ Wa.SizeSStore = B; /* reset bytes malloced */ B *= sizeof (ByTe_2); /* num of bytes needed */ if ((Wa.SStore = realloc (Wa.SStore, B)) == 0) /* get memory */ exit (-1); /* out if err */ } /* END MEMEORY GET */ break; /* STOP TWOBYTE CASE */ } /* BEGIN SIZE CHK SWITCH */ }