-2011-10-25 Paul Eggert <eggert@cs.ucla.edu>
+2011-10-26 Paul Eggert <eggert@cs.ucla.edu>
Fix integer width and related bugs.
* alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit.
(emacs_read, emacs_write):
Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
- (system_process_attributes): Don't assume uid_t, gid_t, and
- double all fit in int or even EMACS_INT.
+ (system_process_attributes): Don't assume uid_t, gid_t, EMACS_INT,
+ and double all fit in int.
* term.c (set_tty_color_mode):
Check that fixnums are in proper range for system types.
* termhooks.h (struct input_event):
struct gcpro gcpro1, gcpro2;
CHECK_NUMBER_OR_FLOAT (pid);
- if (FLOATP (pid))
- {
- double v = XFLOAT_DATA (pid);
- if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0))
- return attrs;
- proc_id = v;
- }
- else
- proc_id = XINT (pid);
+ CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
return attrs;
struct gcpro gcpro1, gcpro2;
CHECK_NUMBER_OR_FLOAT (pid);
- if (FLOATP (pid))
- {
- double v = XFLOAT_DATA (pid);
- if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0))
- return attrs;
- proc_id = v;
- }
- else
- proc_id = XINT (v);
+ CONS_TO_INTEGER (pid, pid_t, proc_id);
sprintf (procfn, "/proc/%"pMd, proc_id);
if (stat (procfn, &st) < 0)
return attrs;