(insert "\n")))
(buffer-string))))))
-(defun haiku-get-numeric-enum (name)
- "Return the numeric value of the system enumerator NAME."
- (or (get name 'haiku-numeric-enum)
- (let ((value 0)
- (offset 0)
- (string (symbol-name name)))
- (cl-loop for octet across string
- do (progn
- (when (or (< octet 0)
- (> octet 255))
- (error "Out of range octet: %d" octet))
- (setq value
- (logior value
- (lsh octet
- (- (* (1- (length string)) 8)
- offset))))
- (setq offset (+ offset 8))))
- (prog1 value
- (put name 'haiku-enumerator-id value)))))
+(eval-and-compile
+ (defun haiku-get-numeric-enum (name)
+ "Return the numeric value of the system enumerator NAME."
+ (or (get name 'haiku-numeric-enum)
+ (let ((value 0)
+ (offset 0)
+ (string (symbol-name name)))
+ (cl-loop for octet across string
+ do (progn
+ (when (or (< octet 0)
+ (> octet 255))
+ (error "Out of range octet: %d" octet))
+ (setq value
+ (logior value
+ (lsh octet
+ (- (* (1- (length string)) 8)
+ offset))))
+ (setq offset (+ offset 8))))
+ (prog1 value
+ (put name 'haiku-enumerator-id value))))))
(defmacro haiku-numeric-enum (name)
"Expand to the numeric value NAME as a system identifier."
break;
}
- memmove (&dpyinfo->failable_requests, first,
- sizeof *first * (last - first));
+ if (first != last)
+ memmove (&dpyinfo->failable_requests, first,
+ sizeof *first * (last - first));
dpyinfo->next_failable_request = (dpyinfo->failable_requests
+ (last - first));
request = dpyinfo->next_failable_request;
max = dpyinfo->failable_requests + N_FAILABLE_REQUESTS;
- if (request > max)
+ if (request >= max)
{
/* There is no point in making this extra sync if all requests
are known to have been fully processed. */
void
x_check_errors (Display *dpy, const char *format)
{
+ struct x_display_info *dpyinfo;
char *string;
/* This shouldn't happen, since x_check_errors should be called
> x_error_message->first_request))
XSync (dpy, False);
+ dpyinfo = x_display_info_for_display (dpy);
+
+ /* Clean the array of failable requests, since a sync happened. */
+ if (dpyinfo)
+ x_clean_failable_requests (dpyinfo);
+
if (x_error_message->string)
{
string = alloca (strlen (x_error_message->string) + 1);
bool
x_had_errors_p (Display *dpy)
{
+ struct x_display_info *dpyinfo;
+
/* This shouldn't happen, since x_check_errors should be called
immediately inside an x_catch_errors block. */
if (dpy != x_error_message->dpy)
> x_error_message->first_request))
XSync (dpy, False);
+ dpyinfo = x_display_info_for_display (dpy);
+
+ /* Clean the array of failable requests, since a sync happened. */
+ if (dpyinfo)
+ x_clean_failable_requests (dpyinfo);
+
return !!x_error_message->string;
}