/********************************************************************/ /* */ /* Packet driver for AMD LANCE ethernet controller */ /* */ /* Copyleft by H. Wieser, 1992 TU-Vienna IAEE */ /* All rights reserved */ /* */ /********************************************************************/ #include #include #include "cookie.h" #include #ifndef NULL #define NULL (void *)0L #endif #define _cookiejar *(long *)0x5A0L COOKIE *new_cookiejar(long n) { register long superstack; register COOKIE *jar,*newjar; register long i,c; jar = get_cookiejar(); i=0; if(jar) for(; jar[i].id != ENDCOOKIE; i++); /* get size of old jar */ if(jar && jar[i].val > n) return(jar); /* there isroom in jar */ newjar = (COOKIE *)malloc(n*sizeof(COOKIE));/* alloc new jar */ if(jar && newjar) for(c=0; cid != ENDCOOKIE) jar++; /* search end of cookiejar */ jar->id = id; (jar+1)->val = jar->val; /* keep size of jar */ jar->val = val; (jar+1)->id = ENDCOOKIE; return(jar); } COOKIE *get_cookie(long id) { register COOKIE *jar; if((jar = get_cookiejar()) == NULL) return(NULL); while(jar->id) { if(jar->id == id) return(jar); /* find cookie */ jar++; } return(NULL); }