Use = when comparing numbers

This commit is contained in:
Christopher Baines 2025-03-10 14:12:42 +00:00
parent 8c79536fa4
commit 2eb5714829
10 changed files with 23 additions and 23 deletions

View file

@ -418,7 +418,7 @@ WHERE derivation_output_details.path = $1"
(http-request build-url))) (http-request build-url)))
(cond (cond
((eq? (response-code response) 200) ((= (response-code response) 200)
(json-string->scm (json-string->scm
(bytevector->string body "utf-8"))) (bytevector->string body "utf-8")))
(else (else
@ -439,7 +439,7 @@ WHERE derivation_output_details.path = $1"
(read-to-eof port)))) (read-to-eof port))))
(handler (handler
(cond (cond
((eq? (response-code response) 200) ((= (response-code response) 200)
(json-string->scm (json-string->scm
(bytevector->string response-body (bytevector->string response-body
"utf-8"))) "utf-8")))
@ -475,7 +475,7 @@ WHERE derivation_output_details.path = $1"
(read-to-eof port)))) (read-to-eof port))))
(handler (handler
(cond (cond
((eq? (response-code response) 200) ((= (response-code response) 200)
(json-string->scm (json-string->scm
(bytevector->string response-body (bytevector->string response-body
"utf-8"))) "utf-8")))

View file

@ -61,7 +61,7 @@
(define group-by-last-element (define group-by-last-element
(lambda (vals) (lambda (vals)
(let ((groups (last vals))) (let ((groups (last vals)))
(cons (if (eq? (length groups) 2) (cons (if (= (length groups) 2)
'common 'common
(first groups)) (first groups))
(drop-right vals 1))))) (drop-right vals 1)))))

View file

@ -677,7 +677,7 @@ SET CONSTRAINTS derivations_by_output_details_set_derivation_id_fkey DEFERRED")
(let loop ((total-deleted 0)) (let loop ((total-deleted 0))
(let ((batch-deleted-count (delete-batch conn))) (let ((batch-deleted-count (delete-batch conn)))
(if (eq? 0 batch-deleted-count) (if (= 0 batch-deleted-count)
(begin (begin
(hash-clear! ignored-derivation-ids) (hash-clear! ignored-derivation-ids)
(let ((batch-deleted-count (delete-batch conn))) (let ((batch-deleted-count (delete-batch conn)))

View file

@ -172,7 +172,7 @@
(simple-format #t "running command: ~A\n" (simple-format #t "running command: ~A\n"
(string-join command)) (string-join command))
(let ((pid (spawn (%config 'sqitch) command))) (let ((pid (spawn (%config 'sqitch) command)))
(unless (= 0 (status:exit-val (cdr (waitpid pid)))) (unless (= 0 (status:exit-val (cdr (waitpid pid)))) ;; TODO Don't use waitppid
(simple-format (simple-format
(current-error-port) (current-error-port)
"error: sqitch command failed\n") "error: sqitch command failed\n")
@ -318,7 +318,7 @@
(cond (cond
((eq? #f val) NULL) ((eq? #f val) NULL)
((string-null? val) ((string-null? val)
(if (eq? 1 (%PQgetisnull (if (= 1 (%PQgetisnull
(squee/unwrap-result-ptr result-ptr) row-i col-i)) (squee/unwrap-result-ptr result-ptr) row-i col-i))
NULL NULL
val)) val))

View file

@ -334,9 +334,9 @@ WHERE job_id = $1")
"\n\n" "\n\n"
(let ((running-jobs (hash-count (const #t) processes))) (let ((running-jobs (hash-count (const #t) processes)))
(cond (cond
((eq? running-jobs 0) ((= running-jobs 0)
"status: 0 running jobs") "status: 0 running jobs")
((eq? running-jobs 1) ((= running-jobs 1)
"status: 1 running job") "status: 1 running job")
(else (else
(simple-format #f "status: ~A running jobs" (simple-format #f "status: ~A running jobs"
@ -363,7 +363,7 @@ WHERE job_id = $1")
(match (hash-ref processes pid) (match (hash-ref processes pid)
((_ (id)) ((_ (id))
(post-job id) (post-job id)
(unless (eq? status 0) (unless (= status 0)
(simple-format (current-error-port) (simple-format (current-error-port)
"pid ~A (job: ~A) failed with status ~A\n" "pid ~A (job: ~A) failed with status ~A\n"
pid id status) pid id status)

View file

@ -250,7 +250,7 @@
string<?))) string<?)))
(map (lambda (lang index) (map (lambda (lang index)
`(tr `(tr
,@(if (eq? index 0) ,@(if (= index 0)
`((td (@ (rowspan ,(length languages))) `((td (@ (rowspan ,(length languages)))
,(case change ,(case change
((new) "New") ((new) "New")

View file

@ -1383,10 +1383,10 @@
(build-server-count (build-server-count
(length build-servers))) (length build-servers)))
(cond (cond
((or (eq? hash-count 0) ((or (= hash-count 0)
(eq? build-server-count 1)) (= build-server-count 1))
"unknown") "unknown")
((eq? hash-count 1) ((= hash-count 1)
"matching") "matching")
((> hash-count 1) ((> hash-count 1)
"not-matching"))))))) "not-matching")))))))

View file

@ -272,7 +272,7 @@
git-repositories))) git-repositories)))
'()) '())
,@(if (> (vector-length licenses) 0) ,@(if (> (vector-length licenses) 0)
`((dt ,(if (eq? (vector-length licenses) 1) `((dt ,(if (= (vector-length licenses) 1)
"License" "License"
"Licenses")) "Licenses"))
(dd (ul (dd (ul
@ -2082,10 +2082,10 @@ figure {
(build-server-count (build-server-count
(length build-servers))) (length build-servers)))
(cond (cond
((or (eq? hash-count 0) ((or (= hash-count 0)
(eq? build-server-count 1)) (= build-server-count 1))
"Unknown") "Unknown")
((eq? hash-count 1) ((= hash-count 1)
'(span (@ (class "text-success")) '(span (@ (class "text-success"))
"Matching")) "Matching"))
((> hash-count 1) ((> hash-count 1)

View file

@ -725,7 +725,7 @@
"," ","
"\"" ,(or hash "") "\"" "\"" ,(or hash "") "\""
")" ")"
,@(if (eq? count-down 0) ,@(if (= count-down 0)
'() '()
'(","))))) '(",")))))
derivation-outputs derivation-outputs
@ -763,7 +763,7 @@
",") ",")
"]" "]"
")" ")"
,@(if (eq? count-down 0) ,@(if (= count-down 0)
'() '()
'(","))))) '(",")))))
derivation-inputs derivation-inputs
@ -789,7 +789,7 @@
(a (@ (href ,source)) (a (@ (href ,source))
,(display-store-item source)) ,(display-store-item source))
"\"" "\""
,@(if (eq? count-down 0) ,@(if (= count-down 0)
'() '()
'(",")))) '(","))))
derivation-sources derivation-sources
@ -850,7 +850,7 @@
`(div "\"" `(div "\""
,(display-possible-store-item arg) ,(display-possible-store-item arg)
"\"" "\""
,@(if (eq? count-down 0) ,@(if (= count-down 0)
'() '()
'(",")))) '(","))))
args args

View file

@ -37,7 +37,7 @@
(lambda (conn) (lambda (conn)
(let ((count (let ((count
(count-git-repositories-with-x-git-repo-header-values conn))) (count-git-repositories-with-x-git-repo-header-values conn)))
(when (eq? count 0) (when (= count 0)
(display (display
"\nerror: no git_repositories exist with a value for x_git_repo_header "\nerror: no git_repositories exist with a value for x_git_repo_header
error: to match emails to repositories, the git_repositories entry must have error: to match emails to repositories, the git_repositories entry must have