3 ms·
I love this part "We give up on this idea, and write the more C-like: xf->info.nprops=2; if((xf->info.props=xalloc(xf->info.nprops*sizeof(FontPropRec)))==
by cstejerean 19y ago
I love this part
"We give up on this idea, and write the more C-like:
xf->info.nprops=2;
if((xf->info.props=xalloc(xf->info.nprops*sizeof(FontPropRec)))==0)
return BadAlloc;
if((xf->info.isStringProp=xalloc(2))==0) {
xfree(xf->info.props);
return BadAlloc;
}
xf->info.props[0].name=MakeAtom("FONTNAME");
xf->info.props[0].value=MakeAtom("FOO");
xf->info.isStringProp[0]=1;
xf->info.props[1].name=MakeAtom("POINTSIZE");
xf->info.props[1].value=5;
xf->info.isStringProp[1]=0;
Which, of course, means that if we add some code that allocates data earlier on, we have to manually update all the emergency deallocations. Oh, well!
At this point, the reader is advised to consider the initial Lisp code again:
(setf (font-properties xf) '(:fontname "FOO" :pointsize 5))
and notice how much more explicit and simple the C code is."