1: #include <X/mit-copyright.h> 2: 3: /* $Header: XFreeColors.c,v 10.4 86/02/01 15:34:07 tony Rel $ */ 4: /* Copyright Massachusetts Institute of Technology 1985 */ 5: 6: #include "XlibInternal.h" 7: XFreeColors (pixels, npixels, planes) 8: register int *pixels; 9: int npixels; 10: int planes; 11: { 12: register Display *dpy; 13: register XReq *req; 14: 15: GetReq (X_FreeColors, 0); 16: req->mask = planes; 17: req->param.s[0] = npixels; 18: 19: /* "pixels" is an array of ints, but the protocol wants 20: * an array of shorts, therefore data must be copied */ 21: { 22: register int i; 23: int nbytes = npixels*sizeof(short); 24: register u_short *proto_pixels = (u_short *) malloc (nbytes); 25: for (i=0;i<npixels;i++) 26: proto_pixels[i] = pixels[i]; 27: Data (dpy, proto_pixels, nbytes); 28: free (proto_pixels); 29: } 30: }