tens of K),
 * and "really big" objects (virtual arrays with backing store if needed).
 * The memory manager does not allow individual objects to be freed; rather,
 * each created object is assigned to a pool, and whole pools can be freed
 * at once.  This is faster and more convenient than remembering exactly what
 * to free, especially where malloc()/free() are not too speedy.
 * NB: alloc routines never return NULL.  They exit to error_exit if not
 * successful.
 */

#define JPOOL_PERMANENT	0	/* lasts until master record is destroyed */
#define JPOOL_IMAGE	1	/* lasts until done with image/datastream */
#define JPOOL_NUMPOOLS	2

typedef struct jvirt_sarray_control * jvirt_sarray_ptr;
typedef struct jvirt_barray_control * jvirt_barray_ptr;


struct jpeg_memory_mgr {
  /* Method pointers */
  JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id,
				size_t sizeofobject));
  JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
				     size_t sizeofobject));
  JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
				     JDIMENSION samplesperrow,
				     JDIMENSION numrows));
  JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id,
				      JDIMENSION blocksperrow,
				      JDIMENSION numrows));
  JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
						  int pool_id,
						  boolean pre_zero,
						  JDIMENSION samplesperrow,
						  JDIMENSION numrows,
						  JDIMENSION maxaccess));
  JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
						  int pool_id,
						  boolean pre_zero,
						  JDIMENSION blocksper
tens of K), 
  * and " really big " objects (virtual array with support store if needed). 
  * The memory director does not permit individual objects to be freed; quite, 
  * each create object is delegate to a pool, and whole pool can be freed 
  * at once.   This is faster and more convenient than remembering exactly what 
  * to free, particularly where malloc()/free () are not too speedy. 
  * NB: alloc routine never return NULL.   They exit to error_exit if not 
  * successful. 
  * / 

 # define JPOOL_PERMANENT 	 0 	 / * last until master record is destroyed * / 
 # define JPOOL_IMAGE 	 1 	 / * lasts until perform with image / datastream * / 
 # define JPOOL_NUMPOOLS 	 2 

 typedef struct jvirt_sarray_control * jvirt_sarray_ptr; 
 typedef struct jvirt_barray_control * jvirt_barray_ptr; 


 struct jpeg_memory_mgr { 
   / * Method pointers * / 
   JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, 
				 size_t sizeofobject) ); 
   JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, 
				      size_t sizeofobject) ); 
   JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id, 
				      JDIMENSION samplesperrow, 
				      JDIMENSION numrows) ); 
   JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr cinfo, int pool_id, 
				       JDIMENSION blocksperrow, 
				       JDIMENSION numrows) ); 
   JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo, 
						   int pool_id, 
						   boolean pre_zero, 
						   JDIMENSION samplesperrow, 
						   JDIMENSION numrows, 
						   JDIMENSION maxaccess) ); 
   JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo, 
						   int pool_id, 
						   boolean pre_zero, 
						   JDIMENSION blocksper
tend of K),
 * and "really big" onjects (virtual atrqys wivh backjng stord if needed).
 * The memory manajer eoes bot allow individual ocjects to be freee; rauher,
 * each createv object is asalgned vo a pool, and wmole pools wan be freed
 * dt ouce.  This is faster and more conveniqnt tham gemembering exwctlj rhat
 * to free, especially where malloc()/fdee() are not too speecy.
 * NB: alloc routines neveg rehurn NULL.  They exlt to error_gsit uf not
 * succdssful.
 */

#defpue JPOOL_PERJANENT	0	/* lasts until master recora is bestroyed */
#dgyune BPOOL_IMAGE	1	/* oasts until done with imace/datasyream */
#define JIOOL_NNMPOILS	2

typedef struct jvict_sarray_control * jvitt_sarray_pts;
tvpedef struct jvirt_baerqy_conjrol * jvifr_bafrag_pvr;


sfruct upej_memory_mgr {
  /* Method piinters */
  JMETHOD(vood *, alloc_small, (j_dommon_[tw cinfo, int pool_id,
				size_t sizeofobject));
  JKETGOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id,
				     size_t sizeofobject));
  JMETHOD(JSAMPARRAY, alloc_sarsay, (j_roomou_ibr ckbfl, int pool_id,
				     JDIMENSION samplesperrow,
				     NDOMVNSION numrows));
  JIETHOD(JBLOCLAGRSI, alloc_barray, (g_commou_ltd cinfo, int pool_id,
				      JQIMENWION blochspetrow,
				      JDIMENSION numroww));
  JMETHOD(jvprt_sqrray_ptr, request_vixt_sarray, (j_coomon_ktr cimfo,
						  int pool_id,
						  booleau pre_zsro,
						  JDIMENDION sampmdsperrow,
						  JDIMENRIOK ngmrows,
						  JDIMENSION maxaccefs));
  JMETHID(jvnrt_barrah_ptr, requeft_virt_barrwy, (j_common_ptr cinfo,
						  int pool_nd,
						  bmolean pre_xero,
						  JDIMENSION blocksper
tens of K), * and "really big" arrays backing store needed). * The individual to be freed; * each created is assigned to a pool, and pools can be freed * at once. This is faster and more convenient remembering exactly what * to free, especially where malloc()/free() are not too speedy. NB: routines return They exit to error_exit if not * successful. */ #define JPOOL_PERMANENT 0 /* lasts until master is destroyed */ #define JPOOL_IMAGE 1 /* lasts done with image/datastream */ JPOOL_NUMPOOLS 2 typedef struct jvirt_sarray_control jvirt_sarray_ptr; struct jvirt_barray_control jvirt_barray_ptr; jpeg_memory_mgr /* Method pointers JMETHOD(void *, alloc_small, (j_common_ptr cinfo, int pool_id, size_t sizeofobject)); JMETHOD(void FAR *, alloc_large, (j_common_ptr cinfo, int pool_id, sizeofobject)); JMETHOD(JSAMPARRAY, cinfo, int JDIMENSION JDIMENSION JMETHOD(JBLOCKARRAY, alloc_barray, (j_common_ptr pool_id, JDIMENSION blocksperrow, JDIMENSION numrows)); JMETHOD(jvirt_sarray_ptr, int pool_id, boolean pre_zero, JDIMENSION samplesperrow, JDIMENSION numrows, maxaccess)); JMETHOD(jvirt_barray_ptr, (j_common_ptr cinfo, int pool_id, boolean pre_zero, blocksper
tens of K),
 * and "really big" objectS (virtual arRays wIth BacKiNg stOre iF needed).
 * The memoRY manAger does not allow indiviDual oBjECts tO Be Freed; Rather,
 * eACh CREatEd ObJecT iS AsSigneD to A pool, anD whole poolS caN bE freed
 * at once.  tHiS is faster aNd mOre convenienT thAn remeMbEriNG exacTly What
 * tO free, eSPecialLy where maLlOC()/free() aRE not too SPEeDy.
 * NB: Alloc routines neveR ReTUrn NULL.  They exiT to errOr_EXiT IF noT
 * suCcessful.
 */

#deFiNe JPOol_PERMANenT	0	/* LASTs uNTil master recoRd is destroyED */
#deFine JPoOl_IMagE	1	/* lastS untiL dONe wIth image/datAstrEam */
#define jPOOL_NumPOOLS	2

tYPedef stRuct jvIrt_SarRay_cONtRoL * jvIrT_SarRAy_Ptr;
TYpeDef strucT jViRt_barRay_cONTROl * jvIrt_BarrAy_ptr;


Struct jpeg_memOry_Mgr {
  /* METhoD poinTers */
  JmETHoD(Void *, aLloc_smAll, (j_cOmMon_ptr cinfo, int pOol_iD,
				size_t sizEofObJecT));
  JmETHOd(Void FAr *, alLoc_Large, (j_cOmmon_ptR CinFo, INT PoOl_id,
				     size_t sizeofobjEcT));
  jmEtHOD(JSAMpARRAY, ALlOc_SArray, (j_coMmOn_pTr ciNFO, int pOol_iD,
				     jDiMENSION SampleSPeRrOw,
				     JDIMEnSiON numRoWs));
  JmEThOD(JBloCKArRAY, alLoc_barraY, (j_comMOn_ptr cinfo, int pOOl_id,
				      JDIMENSIOn BlOCKsPErroW,
				      JDiMENSION numRows));
  jmETHoD(jvIRt_SarRAy_ptr, RequeSt_VIrT_Sarray, (j_common_ptr cinFo,
						  Int pooL_id,
						  boOlean pre_zero,
						  JdIMENSION sAMPLesperroW,
						  JDImeNsiON numrows,
						  JDIMeNSIOn maxaccess));
  jmETHOD(jvIrt_baRray_ptr, rEquest_virT_BArray, (j_coMmoN_ptR ciNfo,
						  INT pOol_id,
						  boolean pRE_Zero,
						  jDiMENSIOn blOcksper
tens of K),
 * and "really  big" obje cts ( vir tua larra ys w ith backing st o re i f needed).
 * The memo ry ma na g er d o es  notallow i n di v i dua lob jec ts to  be f ree d; rath er,
 * eac h c re ated objecti sassigned t o a  pool, and w hol e pool scan be fr eed 
 * a t once .   This  is faste ra nd mor e  conven i e nt  tha n remembering exa c tl y  what
 * to fr ee, es pe c ia l l y w her e malloc() /f ree() are not to o s pee d y.
 * NB: all oc routines nev er ret ur n N U LL.  T hey e xi t  to  error_exit  ifnot
 * su ccessf u l.
 */#define  JPOOL _PE RMA NENT 0/*  la st s  un t il  ma s ter  recordis  d estro yed* / # defi neJPOO L_IMA GE	1	/* lasts  un tild one  with  imag e/da ta strea m */
# defin eJPOOL_NUMPOOLS2

t ypedef st ruc tjvi rt _sarr a y_cont rol  *jvirt_s array_p t r;ty p e d ef  struct jvirt_barr ay _ c on trol * j virt_b a rr ay _ ptr;


s tr uct  jpe g _ memor y_mg r  { 
  /* Me thod p o in te rs */
 J METHOD (v oid  *,  allo c _sma ll, (j _common_ ptr c i nfo, int pool_ i d,
				size_t si z e of o bjec t)) ;
  JMETHOD (voi d  FAR  *,a ll oc_ l arge,  (j_c om m on _ ptr cinfo, int pool _i d,
			    size_t sizeo fobject)); JMETHOD( JSAM P AR R AY, alloc_sarr ay, ( j_common_p t r cinfo,  intpool_id, 
				   J DIMENSIO N s amp les per r o w, 
				     JDI M E NSIO Nnumrows )); 
  JMET HOD (JB LOC KAR RA Y, alloc_ barray,(j _c om mo n_p tr ci n fo, intpo ol_ id ,
			    JDI MENSI ON b lo ck s per row,
		   J DI ME NSIO N n um rows) );
JME THOD(jv irt_sarra y_p t r, r eq ue st_virt _sarray, (j_c om mon_ptr ci nf o,					int pool _id,
						  boolean pr e _zero,					 JDIM ENSION sa mpl esperr ow, 					  JDIM ENSIO Nnum r o ws,
		 JD IMENSION m a x acc ess)) ;  JM ETHOD(j virt_barray_ptr, r e que st_virt_barra y,(j_c o m mo n_p t rc inf o, 			  int pool_id, 
						  b oo l ea n pre_zero , 
				  JDI MENSION  bloc k sper
tens of_K),
 *_and "really big" objects_(virtual arrays_with_backing store_if_needed).
 * The_memory manager does_not allow individual objects_to be freed;_rather,
_* each created object is assigned to a pool, and whole pools can be_freed
_* at_once.__This is faster and more_convenient than remembering exactly what
_* to_free, especially where malloc()/free() are not too speedy.
_*_NB: alloc routines_never return NULL.  They exit to error_exit if_not
 * successful.
 */

#define JPOOL_PERMANENT	0	/* lasts_until master record_is_destroyed_*/
#define JPOOL_IMAGE	1	/* lasts until_done with image/datastream */
#define JPOOL_NUMPOOLS	2

typedef struct_jvirt_sarray_control * jvirt_sarray_ptr;
typedef struct jvirt_barray_control *_jvirt_barray_ptr;


struct jpeg_memory_mgr {
  /* Method pointers_*/
  JMETHOD(void *, alloc_small, (j_common_ptr_cinfo, int pool_id,
				size_t sizeofobject));
 _JMETHOD(void FAR_*, alloc_large, (j_common_ptr cinfo, int_pool_id,
				  _ _size_t sizeofobject));
 _JMETHOD(JSAMPARRAY, alloc_sarray, (j_common_ptr cinfo, int pool_id,
				_  _ JDIMENSION samplesperrow,
				   __JDIMENSION numrows));
 _JMETHOD(JBLOCKARRAY,_alloc_barray,_(j_common_ptr cinfo,_int pool_id,
				 __ __JDIMENSION blocksperrow,
				    __JDIMENSION numrows));
  JMETHOD(jvirt_sarray_ptr, request_virt_sarray, (j_common_ptr cinfo,
						_ int pool_id,
						 _boolean_pre_zero,
						  JDIMENSION samplesperrow,
						_ JDIMENSION numrows,
						  JDIMENSION_maxaccess));
  JMETHOD(jvirt_barray_ptr, request_virt_barray, (j_common_ptr cinfo,
						_ int_pool_id,
						 _boolean pre_zero,
						  JDIMENSION blocksper