comparison src/process.c @ 9969:007d93b04e1f

(make_process): Use allocate_vectorlike and VECSIZE.
author Karl Heuer <kwzh@gnu.org>
date Wed, 16 Nov 1994 05:03:02 +0000
parents 9daedd94a204
children f689803caa92
comparison
equal deleted inserted replaced
9968:943a61c764a5 9969:007d93b04e1f
465 465
466 Lisp_Object 466 Lisp_Object
467 make_process (name) 467 make_process (name)
468 Lisp_Object name; 468 Lisp_Object name;
469 { 469 {
470 struct Lisp_Vector *vec;
470 register Lisp_Object val, tem, name1; 471 register Lisp_Object val, tem, name1;
471 register struct Lisp_Process *p; 472 register struct Lisp_Process *p;
472 char suffix[10]; 473 char suffix[10];
473 register int i; 474 register int i;
474 475
475 /* size of process structure includes the vector header, 476 vec = allocate_vectorlike ((EMACS_INT) VECSIZE (struct Lisp_Process));
476 so deduct for that. But struct Lisp_Vector includes the first 477 for (i = 0; i < VECSIZE (struct Lisp_Process); i++)
477 element, thus deducts too much, so add it back. */ 478 vec->contents[i] = Qnil;
478 val = Fmake_vector (make_number ((sizeof (struct Lisp_Process) 479 vec->size = VECSIZE (struct Lisp_Process);
479 - sizeof (struct Lisp_Vector) 480 p = (struct Lisp_Process *)vec;
480 + sizeof (Lisp_Object)) 481
481 / sizeof (Lisp_Object)),
482 Qnil);
483 XSETTYPE (val, Lisp_Process);
484
485 p = XPROCESS (val);
486 XSETINT (p->infd, -1); 482 XSETINT (p->infd, -1);
487 XSETINT (p->outfd, -1); 483 XSETINT (p->outfd, -1);
488 XSETFASTINT (p->pid, 0); 484 XSETFASTINT (p->pid, 0);
489 XSETFASTINT (p->tick, 0); 485 XSETFASTINT (p->tick, 0);
490 XSETFASTINT (p->update_tick, 0); 486 XSETFASTINT (p->update_tick, 0);
503 sprintf (suffix, "<%d>", i); 499 sprintf (suffix, "<%d>", i);
504 name1 = concat2 (name, build_string (suffix)); 500 name1 = concat2 (name, build_string (suffix));
505 } 501 }
506 name = name1; 502 name = name1;
507 p->name = name; 503 p->name = name;
504 XSETPROCESS (val, p);
508 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 505 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
509 return val; 506 return val;
510 } 507 }
511 508
512 remove_process (proc) 509 remove_process (proc)