comparison src/specifier.c @ 456:e7ef97881643 r21-2-43

Import from CVS: tag r21-2-43
author cvs
date Mon, 13 Aug 2007 11:41:24 +0200
parents 3d3049ae1304
children 183866b06e0b
comparison
equal deleted inserted replaced
455:5b97c1cd6ed0 456:e7ef97881643
352 internal_hash (s->global_specs, depth + 1), 352 internal_hash (s->global_specs, depth + 1),
353 internal_hash (s->frame_specs, depth + 1), 353 internal_hash (s->frame_specs, depth + 1),
354 internal_hash (s->buffer_specs, depth + 1)); 354 internal_hash (s->buffer_specs, depth + 1));
355 } 355 }
356 356
357 inline static size_t
358 aligned_sizeof_specifier (size_t specifier_type_specific_size)
359 {
360 return ALIGN_SIZE (offsetof (Lisp_Specifier, data)
361 + specifier_type_specific_size,
362 ALIGNOF (max_align_t));
363 }
364
357 static size_t 365 static size_t
358 sizeof_specifier (const void *header) 366 sizeof_specifier (const void *header)
359 { 367 {
360 if (GHOST_SPECIFIER_P ((Lisp_Specifier *) header)) 368 const Lisp_Specifier *p = (const Lisp_Specifier *) header;
361 return offsetof (Lisp_Specifier, data); 369 return aligned_sizeof_specifier (GHOST_SPECIFIER_P (p)
362 else 370 ? 0
363 { 371 : p->methods->extra_data_size);
364 const Lisp_Specifier *p = (const Lisp_Specifier *) header;
365 return offsetof (Lisp_Specifier, data) + p->methods->extra_data_size;
366 }
367 } 372 }
368 373
369 static const struct lrecord_description specifier_methods_description_1[] = { 374 static const struct lrecord_description specifier_methods_description_1[] = {
370 { XD_LISP_OBJECT, offsetof (struct specifier_methods, predicate_symbol) }, 375 { XD_LISP_OBJECT, offsetof (struct specifier_methods, predicate_symbol) },
371 { XD_END } 376 { XD_END }
474 make_specifier_internal (struct specifier_methods *spec_meths, 479 make_specifier_internal (struct specifier_methods *spec_meths,
475 size_t data_size, int call_create_meth) 480 size_t data_size, int call_create_meth)
476 { 481 {
477 Lisp_Object specifier; 482 Lisp_Object specifier;
478 Lisp_Specifier *sp = (Lisp_Specifier *) 483 Lisp_Specifier *sp = (Lisp_Specifier *)
479 alloc_lcrecord (offsetof (Lisp_Specifier, data) + data_size, 484 alloc_lcrecord (aligned_sizeof_specifier (data_size), &lrecord_specifier);
480 &lrecord_specifier);
481 485
482 sp->methods = spec_meths; 486 sp->methods = spec_meths;
483 sp->global_specs = Qnil; 487 sp->global_specs = Qnil;
484 sp->device_specs = Qnil; 488 sp->device_specs = Qnil;
485 sp->frame_specs = Qnil; 489 sp->frame_specs = Qnil;