diff options
| author | Paul Eggert | 2011-04-16 15:30:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-16 15:30:01 -0700 |
| commit | c7b7425e227a08bb85565498e517364fbc96dd2d (patch) | |
| tree | 2c8fc8e79bfdb4450b9c1df49fb652e6c1443d5d | |
| parent | 5c1ccb01541c438e596ce2d819d703d67bab25c0 (diff) | |
| parent | c4354cb4f4a3982331180439120ca72734d49cc5 (diff) | |
| download | emacs-c7b7425e227a08bb85565498e517364fbc96dd2d.tar.gz emacs-c7b7425e227a08bb85565498e517364fbc96dd2d.zip | |
Merge from mainline.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 20 | ||||
| -rw-r--r-- | lisp/gnus/gnus-registry.el | 167 | ||||
| -rw-r--r-- | lisp/gnus/registry.el | 24 | ||||
| -rw-r--r-- | lisp/url/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 4 | ||||
| -rw-r--r-- | src/ChangeLog | 54 | ||||
| -rw-r--r-- | src/gnutls.c | 4 | ||||
| -rw-r--r-- | src/indent.c | 3 | ||||
| -rw-r--r-- | src/intervals.c | 4 | ||||
| -rw-r--r-- | src/intervals.h | 17 | ||||
| -rw-r--r-- | src/nsfont.m | 4 | ||||
| -rw-r--r-- | src/regex.c | 141 | ||||
| -rw-r--r-- | src/regex.h | 47 | ||||
| -rw-r--r-- | src/syntax.c | 2 | ||||
| -rw-r--r-- | src/syntax.h | 12 | ||||
| -rw-r--r-- | src/textprop.c | 5 |
17 files changed, 367 insertions, 148 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f3c8e6c498..da2995840da 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -228,7 +228,7 @@ | |||
| 228 | 2011-04-06 Juanma Barranquero <lekktu@gmail.com> | 228 | 2011-04-06 Juanma Barranquero <lekktu@gmail.com> |
| 229 | 229 | ||
| 230 | * files.el (after-find-file-from-revert-buffer): Remove variable. | 230 | * files.el (after-find-file-from-revert-buffer): Remove variable. |
| 231 | (after-find-file): Dont' bind it. | 231 | (after-find-file): Don't bind it. |
| 232 | (revert-buffer-in-progress-p): New variable. | 232 | (revert-buffer-in-progress-p): New variable. |
| 233 | (revert-buffer): Bind it. | 233 | (revert-buffer): Bind it. |
| 234 | Pass nil for `after-find-file-from-revert-buffer'. | 234 | Pass nil for `after-find-file-from-revert-buffer'. |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index be6f3737ae1..eac53d413cc 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2011-04-16 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * registry.el (registry-reindex): New method to recreate the secondary | ||
| 4 | registry indices. | ||
| 5 | |||
| 6 | * gnus-registry.el (gnus-registry-fixup-registry): Use it if the | ||
| 7 | tracked field changes. | ||
| 8 | (gnus-registry-unfollowed-addresses, gnus-registry-track-extra) | ||
| 9 | (gnus-registry-action, gnus-registry-spool-action) | ||
| 10 | (gnus-registry-handle-action) | ||
| 11 | (gnus-registry--split-fancy-with-parent-internal) | ||
| 12 | (gnus-registry-split-fancy-with-parent) | ||
| 13 | (gnus-registry-register-message-ids): Add recipient tracking on spool, | ||
| 14 | move, and delete actions, and for fancy splitting with parent. | ||
| 15 | (gnus-registry-extract-addresses) | ||
| 16 | (gnus-registry-fetch-recipients-fast) | ||
| 17 | (gnus-registry-fetch-header-fast): Convenience functions. | ||
| 18 | (gnus-registry-misc-test): ERT test of | ||
| 19 | `gnus-registry-extract-addresses'. | ||
| 20 | |||
| 1 | 2011-04-15 Teodor Zlatanov <tzz@lifelogs.com> | 21 | 2011-04-15 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 22 | ||
| 3 | * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): | 23 | * gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): |
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 77ed5a55aed..eab4403c34b 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el | |||
| @@ -36,7 +36,7 @@ | |||
| 36 | ;; Put this in your startup file (~/.gnus.el for instance) or use Customize: | 36 | ;; Put this in your startup file (~/.gnus.el for instance) or use Customize: |
| 37 | 37 | ||
| 38 | ;; (setq gnus-registry-max-entries 2500 | 38 | ;; (setq gnus-registry-max-entries 2500 |
| 39 | ;; gnus-registry-track-extra '(sender subject)) | 39 | ;; gnus-registry-track-extra '(sender subject recipient)) |
| 40 | 40 | ||
| 41 | ;; (gnus-registry-initialize) | 41 | ;; (gnus-registry-initialize) |
| 42 | 42 | ||
| @@ -119,7 +119,9 @@ display.") | |||
| 119 | (defcustom gnus-registry-unfollowed-addresses | 119 | (defcustom gnus-registry-unfollowed-addresses |
| 120 | (list (regexp-quote user-mail-address)) | 120 | (list (regexp-quote user-mail-address)) |
| 121 | "List of addresses that gnus-registry-split-fancy-with-parent won't trace. | 121 | "List of addresses that gnus-registry-split-fancy-with-parent won't trace. |
| 122 | The addresses are matched, they don't have to be fully qualified." | 122 | The addresses are matched, they don't have to be fully qualified. |
| 123 | In the messages, these addresses can be the sender or the | ||
| 124 | recipients." | ||
| 123 | :group 'gnus-registry | 125 | :group 'gnus-registry |
| 124 | :type '(repeat regexp)) | 126 | :type '(repeat regexp)) |
| 125 | 127 | ||
| @@ -152,14 +154,15 @@ nnmairix groups are specifically excluded because they are ephemeral." | |||
| 152 | (make-obsolete-variable 'gnus-registry-entry-caching nil "23.4") | 154 | (make-obsolete-variable 'gnus-registry-entry-caching nil "23.4") |
| 153 | (make-obsolete-variable 'gnus-registry-trim-articles-without-groups nil "23.4") | 155 | (make-obsolete-variable 'gnus-registry-trim-articles-without-groups nil "23.4") |
| 154 | 156 | ||
| 155 | (defcustom gnus-registry-track-extra '(subject sender) | 157 | (defcustom gnus-registry-track-extra '(subject sender recipient) |
| 156 | "Whether the registry should track extra data about a message. | 158 | "Whether the registry should track extra data about a message. |
| 157 | The Subject and Sender (From:) headers are tracked this way by | 159 | The subject, recipients (To: and Cc:), and Sender (From:) headers |
| 158 | default." | 160 | are tracked this way by default." |
| 159 | :group 'gnus-registry | 161 | :group 'gnus-registry |
| 160 | :type | 162 | :type |
| 161 | '(set :tag "Tracking choices" | 163 | '(set :tag "Tracking choices" |
| 162 | (const :tag "Track by subject (Subject: header)" subject) | 164 | (const :tag "Track by subject (Subject: header)" subject) |
| 165 | (const :tag "Track by recipient (To: and Cc: headers)" recipient) | ||
| 163 | (const :tag "Track by sender (From: header)" sender))) | 166 | (const :tag "Track by sender (From: header)" sender))) |
| 164 | 167 | ||
| 165 | (defcustom gnus-registry-split-strategy nil | 168 | (defcustom gnus-registry-split-strategy nil |
| @@ -224,18 +227,22 @@ the Bit Bucket." | |||
| 224 | 227 | ||
| 225 | (defun gnus-registry-fixup-registry (db) | 228 | (defun gnus-registry-fixup-registry (db) |
| 226 | (when db | 229 | (when db |
| 227 | (oset db :precious | 230 | (let ((old (oref db :tracked))) |
| 228 | (append gnus-registry-extra-entries-precious | 231 | (oset db :precious |
| 229 | '())) | 232 | (append gnus-registry-extra-entries-precious |
| 230 | (oset db :max-hard | 233 | '())) |
| 231 | (or gnus-registry-max-entries | 234 | (oset db :max-hard |
| 232 | most-positive-fixnum)) | 235 | (or gnus-registry-max-entries |
| 233 | (oset db :max-soft | 236 | most-positive-fixnum)) |
| 234 | (or gnus-registry-max-pruned-entries | 237 | (oset db :max-soft |
| 235 | most-positive-fixnum)) | 238 | (or gnus-registry-max-pruned-entries |
| 236 | (oset db :tracked | 239 | most-positive-fixnum)) |
| 237 | (append gnus-registry-track-extra | 240 | (oset db :tracked |
| 238 | '(mark group keyword)))) | 241 | (append gnus-registry-track-extra |
| 242 | '(mark group keyword))) | ||
| 243 | (when (not (equal old (oref db :tracked))) | ||
| 244 | (gnus-message 4 "Reindexing the Gnus registry (tracked change)") | ||
| 245 | (registry-reindex db)))) | ||
| 239 | db) | 246 | db) |
| 240 | 247 | ||
| 241 | (defun gnus-registry-make-db (&optional file) | 248 | (defun gnus-registry-make-db (&optional file) |
| @@ -296,7 +303,17 @@ This is not required after changing `gnus-registry-cache-file'." | |||
| 296 | (defun gnus-registry-action (action data-header from &optional to method) | 303 | (defun gnus-registry-action (action data-header from &optional to method) |
| 297 | (let* ((id (mail-header-id data-header)) | 304 | (let* ((id (mail-header-id data-header)) |
| 298 | (subject (mail-header-subject data-header)) | 305 | (subject (mail-header-subject data-header)) |
| 299 | (sender (mail-header-from data-header)) | 306 | (recipients (sort (mapcan 'gnus-registry-extract-addresses |
| 307 | (list | ||
| 308 | (or (ignore-errors | ||
| 309 | (mail-header "Cc" data-header)) | ||
| 310 | "") | ||
| 311 | (or (ignore-errors | ||
| 312 | (mail-header "To" data-header)) | ||
| 313 | ""))) | ||
| 314 | 'string-lessp)) | ||
| 315 | (sender (nth 0 (gnus-registry-extract-addresses | ||
| 316 | (mail-header-from data-header)))) | ||
| 300 | (from (gnus-group-guess-full-name-from-command-method from)) | 317 | (from (gnus-group-guess-full-name-from-command-method from)) |
| 301 | (to (if to (gnus-group-guess-full-name-from-command-method to) nil)) | 318 | (to (if to (gnus-group-guess-full-name-from-command-method to) nil)) |
| 302 | (to-name (if to to "the Bit Bucket"))) | 319 | (to-name (if to to "the Bit Bucket"))) |
| @@ -307,10 +324,16 @@ This is not required after changing `gnus-registry-cache-file'." | |||
| 307 | id | 324 | id |
| 308 | ;; unless copying, remove the old "from" group | 325 | ;; unless copying, remove the old "from" group |
| 309 | (if (not (equal 'copy action)) from nil) | 326 | (if (not (equal 'copy action)) from nil) |
| 310 | to subject sender))) | 327 | to subject sender recipients))) |
| 311 | 328 | ||
| 312 | (defun gnus-registry-spool-action (id group &optional subject sender) | 329 | (defun gnus-registry-spool-action (id group &optional subject sender recipients) |
| 313 | (let ((to (gnus-group-guess-full-name-from-command-method group)) | 330 | (let ((to (gnus-group-guess-full-name-from-command-method group)) |
| 331 | (recipients (or recipients | ||
| 332 | (sort (mapcan 'gnus-registry-extract-addresses | ||
| 333 | (list | ||
| 334 | (or (message-fetch-field "cc") "") | ||
| 335 | (or (message-fetch-field "to") ""))) | ||
| 336 | 'string-lessp))) | ||
| 314 | (subject (or subject (message-fetch-field "subject"))) | 337 | (subject (or subject (message-fetch-field "subject"))) |
| 315 | (sender (or sender (message-fetch-field "from")))) | 338 | (sender (or sender (message-fetch-field "from")))) |
| 316 | (when (and (stringp id) (string-match "\r$" id)) | 339 | (when (and (stringp id) (string-match "\r$" id)) |
| @@ -318,12 +341,13 @@ This is not required after changing `gnus-registry-cache-file'." | |||
| 318 | (gnus-message 7 "Gnus registry: article %s spooled to %s" | 341 | (gnus-message 7 "Gnus registry: article %s spooled to %s" |
| 319 | id | 342 | id |
| 320 | to) | 343 | to) |
| 321 | (gnus-registry-handle-action id nil to subject sender))) | 344 | (gnus-registry-handle-action id nil to subject sender recipients))) |
| 322 | 345 | ||
| 323 | (defun gnus-registry-handle-action (id from to subject sender) | 346 | (defun gnus-registry-handle-action (id from to subject sender |
| 347 | &optional recipients) | ||
| 324 | (gnus-message | 348 | (gnus-message |
| 325 | 10 | 349 | 10 |
| 326 | "gnus-registry-handle-action %S" (list id from to subject sender)) | 350 | "gnus-registry-handle-action %S" (list id from to subject sender recipients)) |
| 327 | (let ((db gnus-registry-db) | 351 | (let ((db gnus-registry-db) |
| 328 | ;; safe if not found | 352 | ;; safe if not found |
| 329 | (entry (gnus-registry-get-or-make-entry id)) | 353 | (entry (gnus-registry-get-or-make-entry id)) |
| @@ -340,11 +364,15 @@ This is not required after changing `gnus-registry-cache-file'." | |||
| 340 | (setq entry (cons (delete from (assoc 'group entry)) | 364 | (setq entry (cons (delete from (assoc 'group entry)) |
| 341 | (assq-delete-all 'group entry)))) | 365 | (assq-delete-all 'group entry)))) |
| 342 | 366 | ||
| 343 | (dolist (kv `((group ,to) (sender ,sender) (subject ,subject))) | 367 | (dolist (kv `((group ,to) |
| 368 | (sender ,sender) | ||
| 369 | (recipient ,@recipients) | ||
| 370 | (subject ,subject))) | ||
| 344 | (when (second kv) | 371 | (when (second kv) |
| 345 | (let ((new (or (assq (first kv) entry) | 372 | (let ((new (or (assq (first kv) entry) |
| 346 | (list (first kv))))) | 373 | (list (first kv))))) |
| 347 | (add-to-list 'new (second kv) t) | 374 | (dolist (toadd (cdr kv)) |
| 375 | (add-to-list 'new toadd t)) | ||
| 348 | (setq entry (cons new | 376 | (setq entry (cons new |
| 349 | (assq-delete-all (first kv) entry)))))) | 377 | (assq-delete-all (first kv) entry)))))) |
| 350 | (gnus-message 10 "Gnus registry: new entry for %s is %S" | 378 | (gnus-message 10 "Gnus registry: new entry for %s is %S" |
| @@ -381,6 +409,11 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 381 | ;; these may not be used, but the code is cleaner having them up here | 409 | ;; these may not be used, but the code is cleaner having them up here |
| 382 | (sender (gnus-string-remove-all-properties | 410 | (sender (gnus-string-remove-all-properties |
| 383 | (message-fetch-field "from"))) | 411 | (message-fetch-field "from"))) |
| 412 | (recipients (sort (mapcan 'gnus-registry-extract-addresses | ||
| 413 | (list | ||
| 414 | (or (message-fetch-field "cc") "") | ||
| 415 | (or (message-fetch-field "to") ""))) | ||
| 416 | 'string-lessp)) | ||
| 384 | (subject (gnus-string-remove-all-properties | 417 | (subject (gnus-string-remove-all-properties |
| 385 | (gnus-registry-simplify-subject | 418 | (gnus-registry-simplify-subject |
| 386 | (message-fetch-field "subject")))) | 419 | (message-fetch-field "subject")))) |
| @@ -393,12 +426,13 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 393 | :references references | 426 | :references references |
| 394 | :refstr refstr | 427 | :refstr refstr |
| 395 | :sender sender | 428 | :sender sender |
| 429 | :recipients recipients | ||
| 396 | :subject subject | 430 | :subject subject |
| 397 | :log-agent "Gnus registry fancy splitting with parent"))) | 431 | :log-agent "Gnus registry fancy splitting with parent"))) |
| 398 | 432 | ||
| 399 | (defun* gnus-registry--split-fancy-with-parent-internal | 433 | (defun* gnus-registry--split-fancy-with-parent-internal |
| 400 | (&rest spec | 434 | (&rest spec |
| 401 | &key references refstr sender subject log-agent | 435 | &key references refstr sender subject recipients log-agent |
| 402 | &allow-other-keys) | 436 | &allow-other-keys) |
| 403 | (gnus-message | 437 | (gnus-message |
| 404 | 10 | 438 | 10 |
| @@ -478,6 +512,36 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." | |||
| 478 | (setq found (gnus-registry-post-process-groups | 512 | (setq found (gnus-registry-post-process-groups |
| 479 | "sender" sender found))) | 513 | "sender" sender found))) |
| 480 | 514 | ||
| 515 | ;; else: there were no matches, try the extra tracking by recipient | ||
| 516 | (when (and (null found) | ||
| 517 | (memq 'recipient gnus-registry-track-extra) | ||
| 518 | recipients) | ||
| 519 | (dolist (recp recipients) | ||
| 520 | (when (and (null found) | ||
| 521 | (not (gnus-grep-in-list | ||
| 522 | recp | ||
| 523 | gnus-registry-unfollowed-addresses))) | ||
| 524 | (let ((groups (apply 'append | ||
| 525 | (mapcar | ||
| 526 | (lambda (reference) | ||
| 527 | (gnus-registry-get-id-key reference 'group)) | ||
| 528 | (registry-lookup-secondary-value | ||
| 529 | db 'recipient recp))))) | ||
| 530 | (setq found | ||
| 531 | (loop for group in groups | ||
| 532 | when (gnus-registry-follow-group-p group) | ||
| 533 | do (gnus-message | ||
| 534 | ;; warn more if gnus-registry-track-extra | ||
| 535 | (if gnus-registry-track-extra 7 9) | ||
| 536 | "%s (extra tracking) traced recipient '%s' to %s" | ||
| 537 | log-agent recp group) | ||
| 538 | collect group))))) | ||
| 539 | |||
| 540 | ;; filter the found groups and return them | ||
| 541 | ;; the found groups are NOT the full groups | ||
| 542 | (setq found (gnus-registry-post-process-groups | ||
| 543 | "recipients" (mapconcat 'identity recipients ", ") found))) | ||
| 544 | |||
| 481 | ;; after the (cond) we extract the actual value safely | 545 | ;; after the (cond) we extract the actual value safely |
| 482 | (car-safe found))) | 546 | (car-safe found))) |
| 483 | 547 | ||
| @@ -629,7 +693,8 @@ Overrides existing keywords with FORCE set non-nil." | |||
| 629 | article gnus-newsgroup-name) | 693 | article gnus-newsgroup-name) |
| 630 | (gnus-registry-handle-action id nil gnus-newsgroup-name | 694 | (gnus-registry-handle-action id nil gnus-newsgroup-name |
| 631 | (gnus-registry-fetch-simplified-message-subject-fast article) | 695 | (gnus-registry-fetch-simplified-message-subject-fast article) |
| 632 | (gnus-registry-fetch-sender-fast article))))))) | 696 | (gnus-registry-fetch-sender-fast article) |
| 697 | (gnus-registry-fetch-recipients-fast article))))))) | ||
| 633 | 698 | ||
| 634 | ;; message field fetchers | 699 | ;; message field fetchers |
| 635 | (defun gnus-registry-fetch-message-id-fast (article) | 700 | (defun gnus-registry-fetch-message-id-fast (article) |
| @@ -639,6 +704,21 @@ Overrides existing keywords with FORCE set non-nil." | |||
| 639 | (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil)))) | 704 | (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil)))) |
| 640 | nil)) | 705 | nil)) |
| 641 | 706 | ||
| 707 | (defun gnus-registry-extract-addresses (text) | ||
| 708 | "Extract all the addresses in a normalized way from TEXT. | ||
| 709 | Returns an unsorted list of strings in the name <address> format. | ||
| 710 | Addresses without a name will say \"noname\"." | ||
| 711 | (mapcar (lambda (add) | ||
| 712 | (gnus-string-remove-all-properties | ||
| 713 | (let* ((name (or (nth 0 add) "noname")) | ||
| 714 | (addr (nth 1 add)) | ||
| 715 | (addr (if (bufferp addr) | ||
| 716 | (with-current-buffer addr | ||
| 717 | (buffer-string)) | ||
| 718 | addr))) | ||
| 719 | (format "%s <%s>" name addr)))) | ||
| 720 | (mail-extract-address-components text t))) | ||
| 721 | |||
| 642 | (defun gnus-registry-simplify-subject (subject) | 722 | (defun gnus-registry-simplify-subject (subject) |
| 643 | (if (stringp subject) | 723 | (if (stringp subject) |
| 644 | (gnus-simplify-subject subject) | 724 | (gnus-simplify-subject subject) |
| @@ -655,12 +735,26 @@ Overrides existing keywords with FORCE set non-nil." | |||
| 655 | nil)) | 735 | nil)) |
| 656 | 736 | ||
| 657 | (defun gnus-registry-fetch-sender-fast (article) | 737 | (defun gnus-registry-fetch-sender-fast (article) |
| 658 | "Fetch the Sender quickly, using the internal gnus-data-list function" | 738 | (gnus-registry-fetch-header-fast "from" article)) |
| 739 | |||
| 740 | (defun gnus-registry-fetch-recipients-fast (article) | ||
| 741 | (sort (mapcan 'gnus-registry-extract-addresses | ||
| 742 | (list | ||
| 743 | (or (ignore-errors | ||
| 744 | (gnus-registry-fetch-header-fast "Cc" article)) | ||
| 745 | "") | ||
| 746 | (or (ignore-errors | ||
| 747 | (gnus-registry-fetch-header-fast "To" article)) | ||
| 748 | ""))) | ||
| 749 | 'string-lessp)) | ||
| 750 | |||
| 751 | (defun gnus-registry-fetch-header-fast (article header) | ||
| 752 | "Fetch the HEADER quickly, using the internal gnus-data-list function" | ||
| 659 | (if (and (numberp article) | 753 | (if (and (numberp article) |
| 660 | (assoc article (gnus-data-list nil))) | 754 | (assoc article (gnus-data-list nil))) |
| 661 | (gnus-string-remove-all-properties | 755 | (gnus-string-remove-all-properties |
| 662 | (mail-header-from (gnus-data-header | 756 | (mail-header header (gnus-data-header |
| 663 | (assoc article (gnus-data-list nil))))) | 757 | (assoc article (gnus-data-list nil))))) |
| 664 | nil)) | 758 | nil)) |
| 665 | 759 | ||
| 666 | ;; registry marks glue | 760 | ;; registry marks glue |
| @@ -902,6 +996,19 @@ only the last one's marks are returned." | |||
| 902 | (gnus-registry-set-id-key id key val)))) | 996 | (gnus-registry-set-id-key id key val)))) |
| 903 | (message "Import done, collected %d entries" count)))) | 997 | (message "Import done, collected %d entries" count)))) |
| 904 | 998 | ||
| 999 | (ert-deftest gnus-registry-misc-test () | ||
| 1000 | (should-error (gnus-registry-extract-addresses '("" ""))) | ||
| 1001 | |||
| 1002 | (should (equal '("Ted Zlatanov <tzz@lifelogs.com>" | ||
| 1003 | "noname <ed@you.me>" | ||
| 1004 | "noname <cyd@stupidchicken.com>" | ||
| 1005 | "noname <tzz@lifelogs.com>") | ||
| 1006 | (gnus-registry-extract-addresses | ||
| 1007 | (concat "Ted Zlatanov <tzz@lifelogs.com>, " | ||
| 1008 | "ed <ed@you.me>, " ; "ed" is not a valid name here | ||
| 1009 | "cyd@stupidchicken.com, " | ||
| 1010 | "tzz@lifelogs.com"))))) | ||
| 1011 | |||
| 905 | (ert-deftest gnus-registry-usage-test () | 1012 | (ert-deftest gnus-registry-usage-test () |
| 906 | (let* ((n 100) | 1013 | (let* ((n 100) |
| 907 | (tempfile (make-temp-file "gnus-registry-persist")) | 1014 | (tempfile (make-temp-file "gnus-registry-persist")) |
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el index 23e75815979..3e638427897 100644 --- a/lisp/gnus/registry.el +++ b/lisp/gnus/registry.el | |||
| @@ -281,6 +281,25 @@ Errors out if the key exists already." | |||
| 281 | (registry-lookup-secondary-value db tr val value-keys)))) | 281 | (registry-lookup-secondary-value db tr val value-keys)))) |
| 282 | entry) | 282 | entry) |
| 283 | 283 | ||
| 284 | (defmethod registry-reindex ((db registry-db)) | ||
| 285 | "Rebuild the secondary indices of registry-db THIS." | ||
| 286 | (let ((count 0) | ||
| 287 | (expected (* (length (oref db :tracked)) (registry-size db)))) | ||
| 288 | (dolist (tr (oref db :tracked)) | ||
| 289 | (let (values) | ||
| 290 | (maphash | ||
| 291 | (lambda (key v) | ||
| 292 | (incf count) | ||
| 293 | (when (and (< 0 expected) | ||
| 294 | (= 0 (mod count 1000))) | ||
| 295 | (message "reindexing: %d of %d (%.2f%%)" | ||
| 296 | count expected (/ (* 1000 count) expected))) | ||
| 297 | (dolist (val (cdr-safe (assq tr v))) | ||
| 298 | (let* ((value-keys (registry-lookup-secondary-value db tr val))) | ||
| 299 | (push key value-keys) | ||
| 300 | (registry-lookup-secondary-value db tr val value-keys)))) | ||
| 301 | (oref db :data)))))) | ||
| 302 | |||
| 284 | (defmethod registry-size ((db registry-db)) | 303 | (defmethod registry-size ((db registry-db)) |
| 285 | "Returns the size of the registry-db object THIS. | 304 | "Returns the size of the registry-db object THIS. |
| 286 | This is the key count of the :data slot." | 305 | This is the key count of the :data slot." |
| @@ -360,10 +379,11 @@ Removes only entries without the :precious keys." | |||
| 360 | (when (boundp 'lexical-binding) | 379 | (when (boundp 'lexical-binding) |
| 361 | (message "Individual lookup (breaks before lexbind)") | 380 | (message "Individual lookup (breaks before lexbind)") |
| 362 | (should (= 58 | 381 | (should (= 58 |
| 363 | (caadr (registry-lookup-breaks-before-lexbind db '(1 58 99))))) | 382 | (caadr (registry-lookup-breaks-before-lexbind db '(1 58 99))))) |
| 364 | (message "Grouped individual lookup (breaks before lexbind)") | 383 | (message "Grouped individual lookup (breaks before lexbind)") |
| 365 | (should (= 3 | 384 | (should (= 3 |
| 366 | (length (registry-lookup-breaks-before-lexbind db '(1 58 99)))))) | 385 | (length (registry-lookup-breaks-before-lexbind db |
| 386 | '(1 58 99)))))) | ||
| 367 | (message "Search") | 387 | (message "Search") |
| 368 | (should (= n (length (registry-search db :all t)))) | 388 | (should (= n (length (registry-search db :all t)))) |
| 369 | (should (= n (length (registry-search db :member '((sender "me")))))) | 389 | (should (= n (length (registry-search db :member '((sender "me")))))) |
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index f75a3444e0c..528b63a6448 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-04-16 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * url-http.el (url-http-wait-for-headers-change-function): Protect | ||
| 4 | against malformed headerless responses from servers. | ||
| 5 | |||
| 1 | 2011-04-02 Chong Yidong <cyd@stupidchicken.com> | 6 | 2011-04-02 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * url-gw.el (url-open-stream): Use new open-network-stream | 8 | * url-gw.el (url-open-stream): Use new open-network-stream |
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 07e57cf3301..28071e7165a 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -1077,6 +1077,10 @@ the end of the document." | |||
| 1077 | (downcase url-http-transfer-encoding))) | 1077 | (downcase url-http-transfer-encoding))) |
| 1078 | 1078 | ||
| 1079 | (cond | 1079 | (cond |
| 1080 | ((null url-http-response-status) | ||
| 1081 | ;; We got back a headerless malformed response from the | ||
| 1082 | ;; server. | ||
| 1083 | (url-http-activate-callback)) | ||
| 1080 | ((or (= url-http-response-status 204) | 1084 | ((or (= url-http-response-status 204) |
| 1081 | (= url-http-response-status 205)) | 1085 | (= url-http-response-status 205)) |
| 1082 | (url-http-debug "%d response must have headers only (%s)." | 1086 | (url-http-debug "%d response must have headers only (%s)." |
diff --git a/src/ChangeLog b/src/ChangeLog index 61509caf744..52a48a87e80 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -101,6 +101,52 @@ | |||
| 101 | * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if | 101 | * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if |
| 102 | USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then. | 102 | USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then. |
| 103 | 103 | ||
| 104 | 2011-04-16 Eli Zaretskii <eliz@gnu.org> | ||
| 105 | |||
| 106 | * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'. | ||
| 107 | |||
| 108 | Fix regex.c, syntax.c and friends for buffers > 2GB. | ||
| 109 | * syntax.h (struct gl_state_s): Declare character position members | ||
| 110 | EMACS_INT. | ||
| 111 | |||
| 112 | * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. | ||
| 113 | |||
| 114 | * textprop.c (verify_interval_modification, interval_of): Declare | ||
| 115 | arguments EMACS_INT. | ||
| 116 | |||
| 117 | * intervals.c (adjust_intervals_for_insertion): Declare arguments | ||
| 118 | EMACS_INT. | ||
| 119 | |||
| 120 | * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'. | ||
| 121 | |||
| 122 | * indent.c (Fvertical_motion): Local variable it_start is now | ||
| 123 | EMACS_INT. | ||
| 124 | |||
| 125 | * regex.c (re_match, re_match_2, re_match_2_internal) | ||
| 126 | (bcmp_translate, regcomp, regexec, print_double_string) | ||
| 127 | (group_in_compile_stack, re_search, re_search_2, regex_compile) | ||
| 128 | (re_compile_pattern, re_exec): Declare arguments and local | ||
| 129 | variables `size_t' and `ssize_t' and return values `regoff_t', as | ||
| 130 | appropriate. | ||
| 131 | (POP_FAILURE_REG_OR_COUNT) <pfreg>: Declare `long'. | ||
| 132 | (CHECK_INFINITE_LOOP) <failure>: Declare `ssize_t'. | ||
| 133 | <compile_stack_type>: `size' and `avail' are now `size_t'. | ||
| 134 | |||
| 135 | * regex.h <regoff_t>: Use ssize_t, not int. | ||
| 136 | (re_search, re_search_2, re_match, re_match_2): Arguments that | ||
| 137 | specify buffer/string position and length are now ssize_t and | ||
| 138 | size_t. Return type is regoff_t. | ||
| 139 | |||
| 140 | 2011-04-16 Ben Key <bkey76@gmail.com> | ||
| 141 | |||
| 142 | * nsfont.m: Fixed bugs in ns_get_family and | ||
| 143 | ns_descriptor_to_entity that were caused by using free to | ||
| 144 | deallocate memory blocks that were allocated by xmalloc (via | ||
| 145 | xstrdup). This caused Emacs to crash when compiled with | ||
| 146 | XMALLOC_OVERRUN_CHECK defined (when Emacs was configured with | ||
| 147 | --enable-checking=xmallocoverrun). xfree is now used to | ||
| 148 | deallocate these memory blocks. | ||
| 149 | |||
| 104 | 2011-04-15 Paul Eggert <eggert@cs.ucla.edu> | 150 | 2011-04-15 Paul Eggert <eggert@cs.ucla.edu> |
| 105 | 151 | ||
| 106 | * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT. | 152 | * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT. |
| @@ -132,10 +178,10 @@ | |||
| 132 | 178 | ||
| 133 | 2011-04-15 Ben Key <bkey76@gmail.com> | 179 | 2011-04-15 Ben Key <bkey76@gmail.com> |
| 134 | 180 | ||
| 135 | * keyboard.c (Qundefined): Don't declare static since it is | 181 | * keyboard.c (Qundefined): Don't declare static since it is used |
| 136 | used in nsfns.m. | 182 | in nsfns.m. |
| 137 | * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't | 183 | * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't declare |
| 138 | declare static since they are used in nsfont.m. | 184 | static since they are used in nsfont.m. |
| 139 | 185 | ||
| 140 | 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca> | 186 | 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca> |
| 141 | 187 | ||
diff --git a/src/gnutls.c b/src/gnutls.c index d7328e114c7..f4f2b9bbd35 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -456,7 +456,7 @@ one trustfile (usually a CA bundle). */) | |||
| 456 | else | 456 | else |
| 457 | { | 457 | { |
| 458 | error ("Sorry, GnuTLS can't use non-string trustfile %s", | 458 | error ("Sorry, GnuTLS can't use non-string trustfile %s", |
| 459 | trustfile); | 459 | SDATA (trustfile)); |
| 460 | } | 460 | } |
| 461 | } | 461 | } |
| 462 | 462 | ||
| @@ -478,7 +478,7 @@ one trustfile (usually a CA bundle). */) | |||
| 478 | else | 478 | else |
| 479 | { | 479 | { |
| 480 | error ("Sorry, GnuTLS can't use non-string keyfile %s", | 480 | error ("Sorry, GnuTLS can't use non-string keyfile %s", |
| 481 | keyfile); | 481 | SDATA (keyfile)); |
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| 484 | } | 484 | } |
diff --git a/src/indent.c b/src/indent.c index 0bfe2e61ca6..094f6dabd55 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -2026,7 +2026,8 @@ whether or not it is currently displayed in some window. */) | |||
| 2026 | } | 2026 | } |
| 2027 | else | 2027 | else |
| 2028 | { | 2028 | { |
| 2029 | int it_start, first_x, it_overshoot_expected IF_LINT (= 0); | 2029 | EMACS_INT it_start; |
| 2030 | int first_x, it_overshoot_expected IF_LINT (= 0); | ||
| 2030 | 2031 | ||
| 2031 | SET_TEXT_POS (pt, PT, PT_BYTE); | 2032 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| 2032 | start_display (&it, w, pt); | 2033 | start_display (&it, w, pt); |
diff --git a/src/intervals.c b/src/intervals.c index 3be6e2d1ffa..7ce1796d8eb 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -805,9 +805,9 @@ update_interval (register INTERVAL i, EMACS_INT pos) | |||
| 805 | static INTERVAL | 805 | static INTERVAL |
| 806 | adjust_intervals_for_insertion (tree, position, length) | 806 | adjust_intervals_for_insertion (tree, position, length) |
| 807 | INTERVAL tree; | 807 | INTERVAL tree; |
| 808 | int position, length; | 808 | EMACS_INT position, length; |
| 809 | { | 809 | { |
| 810 | register int relative_position; | 810 | register EMACS_INT relative_position; |
| 811 | register INTERVAL this; | 811 | register INTERVAL this; |
| 812 | 812 | ||
| 813 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ | 813 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ |
diff --git a/src/intervals.h b/src/intervals.h index f1679eb8b40..6cf5c89374b 100644 --- a/src/intervals.h +++ b/src/intervals.h | |||
| @@ -161,12 +161,12 @@ struct interval | |||
| 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) | 161 | (INTERVAL_HAS_PARENT (i) ? INTERVAL_PARENT (i) : 0) |
| 162 | 162 | ||
| 163 | /* Abort if interval I's size is negative. */ | 163 | /* Abort if interval I's size is negative. */ |
| 164 | #define CHECK_TOTAL_LENGTH(i) \ | 164 | #define CHECK_TOTAL_LENGTH(i) \ |
| 165 | do \ | 165 | do \ |
| 166 | { \ | 166 | { \ |
| 167 | if ((int) (i)->total_length < 0) \ | 167 | if ((EMACS_INT) (i)->total_length < 0) \ |
| 168 | abort (); \ | 168 | abort (); \ |
| 169 | } \ | 169 | } \ |
| 170 | while (0) | 170 | while (0) |
| 171 | 171 | ||
| 172 | /* Reset this interval to its vanilla, or no-property state. */ | 172 | /* Reset this interval to its vanilla, or no-property state. */ |
| @@ -269,7 +269,8 @@ extern INTERVAL merge_interval_left (INTERVAL); | |||
| 269 | extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); | 269 | extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); |
| 270 | extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, | 270 | extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, |
| 271 | struct buffer *, int); | 271 | struct buffer *, int); |
| 272 | extern void verify_interval_modification (struct buffer *, int, int); | 272 | extern void verify_interval_modification (struct buffer *, |
| 273 | EMACS_INT, EMACS_INT); | ||
| 273 | extern INTERVAL balance_intervals (INTERVAL); | 274 | extern INTERVAL balance_intervals (INTERVAL); |
| 274 | extern void copy_intervals_to_string (Lisp_Object, struct buffer *, | 275 | extern void copy_intervals_to_string (Lisp_Object, struct buffer *, |
| 275 | EMACS_INT, EMACS_INT); | 276 | EMACS_INT, EMACS_INT); |
| @@ -285,7 +286,7 @@ extern INTERVAL update_interval (INTERVAL, EMACS_INT); | |||
| 285 | extern void set_intervals_multibyte (int); | 286 | extern void set_intervals_multibyte (int); |
| 286 | extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, | 287 | extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, |
| 287 | Lisp_Object *, int); | 288 | Lisp_Object *, int); |
| 288 | extern INTERVAL interval_of (int, Lisp_Object); | 289 | extern INTERVAL interval_of (EMACS_INT, Lisp_Object); |
| 289 | 290 | ||
| 290 | /* Defined in xdisp.c */ | 291 | /* Defined in xdisp.c */ |
| 291 | extern int invisible_p (Lisp_Object, Lisp_Object); | 292 | extern int invisible_p (Lisp_Object, Lisp_Object); |
diff --git a/src/nsfont.m b/src/nsfont.m index 48d40223553..76c70aadf9f 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -104,7 +104,7 @@ ns_get_family (Lisp_Object font_spec) | |||
| 104 | NSString *family; | 104 | NSString *family; |
| 105 | ns_unescape_name (tmp); | 105 | ns_unescape_name (tmp); |
| 106 | family = [NSString stringWithUTF8String: tmp]; | 106 | family = [NSString stringWithUTF8String: tmp]; |
| 107 | free (tmp); | 107 | xfree (tmp); |
| 108 | return family; | 108 | return family; |
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| @@ -217,7 +217,7 @@ ns_descriptor_to_entity (NSFontDescriptor *desc, | |||
| 217 | debug_print (font_entity); | 217 | debug_print (font_entity); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | free (escapedFamily); | 220 | xfree (escapedFamily); |
| 221 | return font_entity; | 221 | return font_entity; |
| 222 | } | 222 | } |
| 223 | 223 | ||
diff --git a/src/regex.c b/src/regex.c index a60ff0ce35c..479239897bc 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -569,12 +569,12 @@ typedef char boolean; | |||
| 569 | #define false 0 | 569 | #define false 0 |
| 570 | #define true 1 | 570 | #define true 1 |
| 571 | 571 | ||
| 572 | static int re_match_2_internal _RE_ARGS ((struct re_pattern_buffer *bufp, | 572 | static regoff_t re_match_2_internal _RE_ARGS ((struct re_pattern_buffer *bufp, |
| 573 | re_char *string1, int size1, | 573 | re_char *string1, size_t size1, |
| 574 | re_char *string2, int size2, | 574 | re_char *string2, size_t size2, |
| 575 | int pos, | 575 | ssize_t pos, |
| 576 | struct re_registers *regs, | 576 | struct re_registers *regs, |
| 577 | int stop)); | 577 | ssize_t stop)); |
| 578 | 578 | ||
| 579 | /* These are the command codes that appear in compiled regular | 579 | /* These are the command codes that appear in compiled regular |
| 580 | expressions. Some opcodes are followed by argument bytes. A | 580 | expressions. Some opcodes are followed by argument bytes. A |
| @@ -1230,10 +1230,10 @@ print_double_string (where, string1, size1, string2, size2) | |||
| 1230 | re_char *where; | 1230 | re_char *where; |
| 1231 | re_char *string1; | 1231 | re_char *string1; |
| 1232 | re_char *string2; | 1232 | re_char *string2; |
| 1233 | int size1; | 1233 | ssize_t size1; |
| 1234 | int size2; | 1234 | ssize_t size2; |
| 1235 | { | 1235 | { |
| 1236 | int this_char; | 1236 | ssize_t this_char; |
| 1237 | 1237 | ||
| 1238 | if (where == NULL) | 1238 | if (where == NULL) |
| 1239 | printf ("(null)"); | 1239 | printf ("(null)"); |
| @@ -1546,7 +1546,7 @@ do { \ | |||
| 1546 | /* Pop a saved register off the stack. */ | 1546 | /* Pop a saved register off the stack. */ |
| 1547 | #define POP_FAILURE_REG_OR_COUNT() \ | 1547 | #define POP_FAILURE_REG_OR_COUNT() \ |
| 1548 | do { \ | 1548 | do { \ |
| 1549 | int pfreg = POP_FAILURE_INT (); \ | 1549 | long pfreg = POP_FAILURE_INT (); \ |
| 1550 | if (pfreg == -1) \ | 1550 | if (pfreg == -1) \ |
| 1551 | { \ | 1551 | { \ |
| 1552 | /* It's a counter. */ \ | 1552 | /* It's a counter. */ \ |
| @@ -1568,7 +1568,7 @@ do { \ | |||
| 1568 | /* Check that we are not stuck in an infinite loop. */ | 1568 | /* Check that we are not stuck in an infinite loop. */ |
| 1569 | #define CHECK_INFINITE_LOOP(pat_cur, string_place) \ | 1569 | #define CHECK_INFINITE_LOOP(pat_cur, string_place) \ |
| 1570 | do { \ | 1570 | do { \ |
| 1571 | int failure = TOP_FAILURE_HANDLE (); \ | 1571 | ssize_t failure = TOP_FAILURE_HANDLE (); \ |
| 1572 | /* Check for infinite matching loops */ \ | 1572 | /* Check for infinite matching loops */ \ |
| 1573 | while (failure > 0 \ | 1573 | while (failure > 0 \ |
| 1574 | && (FAILURE_STR (failure) == string_place \ | 1574 | && (FAILURE_STR (failure) == string_place \ |
| @@ -1876,8 +1876,8 @@ typedef struct | |||
| 1876 | typedef struct | 1876 | typedef struct |
| 1877 | { | 1877 | { |
| 1878 | compile_stack_elt_t *stack; | 1878 | compile_stack_elt_t *stack; |
| 1879 | unsigned size; | 1879 | size_t size; |
| 1880 | unsigned avail; /* Offset of next open position. */ | 1880 | size_t avail; /* Offset of next open position. */ |
| 1881 | } compile_stack_type; | 1881 | } compile_stack_type; |
| 1882 | 1882 | ||
| 1883 | 1883 | ||
| @@ -2779,7 +2779,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct | |||
| 2779 | if (many_times_ok) | 2779 | if (many_times_ok) |
| 2780 | { | 2780 | { |
| 2781 | boolean simple = skip_one_char (laststart) == b; | 2781 | boolean simple = skip_one_char (laststart) == b; |
| 2782 | unsigned int startoffset = 0; | 2782 | size_t startoffset = 0; |
| 2783 | re_opcode_t ofj = | 2783 | re_opcode_t ofj = |
| 2784 | /* Check if the loop can match the empty string. */ | 2784 | /* Check if the loop can match the empty string. */ |
| 2785 | (simple || !analyse_first (laststart, b, NULL, 0)) | 2785 | (simple || !analyse_first (laststart, b, NULL, 0)) |
| @@ -3361,7 +3361,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct | |||
| 3361 | _____ _____ | 3361 | _____ _____ |
| 3362 | | | | | | 3362 | | | | | |
| 3363 | | v | v | 3363 | | v | v |
| 3364 | a | b | c | 3364 | a | b | c |
| 3365 | 3365 | ||
| 3366 | If we are at `b', then fixup_alt_jump right now points to a | 3366 | If we are at `b', then fixup_alt_jump right now points to a |
| 3367 | three-byte space after `a'. We'll put in the jump, set | 3367 | three-byte space after `a'. We'll put in the jump, set |
| @@ -3905,7 +3905,7 @@ at_endline_loc_p (const re_char *p, const re_char *pend, reg_syntax_t syntax) | |||
| 3905 | static boolean | 3905 | static boolean |
| 3906 | group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum) | 3906 | group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum) |
| 3907 | { | 3907 | { |
| 3908 | int this_element; | 3908 | ssize_t this_element; |
| 3909 | 3909 | ||
| 3910 | for (this_element = compile_stack.avail - 1; | 3910 | for (this_element = compile_stack.avail - 1; |
| 3911 | this_element >= 0; | 3911 | this_element >= 0; |
| @@ -4291,8 +4291,9 @@ WEAK_ALIAS (__re_set_registers, re_set_registers) | |||
| 4291 | /* Like re_search_2, below, but only one string is specified, and | 4291 | /* Like re_search_2, below, but only one string is specified, and |
| 4292 | doesn't let you say where to stop matching. */ | 4292 | doesn't let you say where to stop matching. */ |
| 4293 | 4293 | ||
| 4294 | int | 4294 | regoff_t |
| 4295 | re_search (struct re_pattern_buffer *bufp, const char *string, int size, int startpos, int range, struct re_registers *regs) | 4295 | re_search (struct re_pattern_buffer *bufp, const char *string, size_t size, |
| 4296 | ssize_t startpos, ssize_t range, struct re_registers *regs) | ||
| 4296 | { | 4297 | { |
| 4297 | return re_search_2 (bufp, NULL, 0, string, size, startpos, range, | 4298 | return re_search_2 (bufp, NULL, 0, string, size, startpos, range, |
| 4298 | regs, size); | 4299 | regs, size); |
| @@ -4328,16 +4329,18 @@ WEAK_ALIAS (__re_search, re_search) | |||
| 4328 | found, -1 if no match, or -2 if error (such as failure | 4329 | found, -1 if no match, or -2 if error (such as failure |
| 4329 | stack overflow). */ | 4330 | stack overflow). */ |
| 4330 | 4331 | ||
| 4331 | int | 4332 | regoff_t |
| 4332 | re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const char *str2, int size2, int startpos, int range, struct re_registers *regs, int stop) | 4333 | re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1, |
| 4334 | const char *str2, size_t size2, ssize_t startpos, ssize_t range, | ||
| 4335 | struct re_registers *regs, ssize_t stop) | ||
| 4333 | { | 4336 | { |
| 4334 | int val; | 4337 | regoff_t val; |
| 4335 | re_char *string1 = (re_char*) str1; | 4338 | re_char *string1 = (re_char*) str1; |
| 4336 | re_char *string2 = (re_char*) str2; | 4339 | re_char *string2 = (re_char*) str2; |
| 4337 | register char *fastmap = bufp->fastmap; | 4340 | register char *fastmap = bufp->fastmap; |
| 4338 | register RE_TRANSLATE_TYPE translate = bufp->translate; | 4341 | register RE_TRANSLATE_TYPE translate = bufp->translate; |
| 4339 | int total_size = size1 + size2; | 4342 | size_t total_size = size1 + size2; |
| 4340 | int endpos = startpos + range; | 4343 | ssize_t endpos = startpos + range; |
| 4341 | boolean anchored_start; | 4344 | boolean anchored_start; |
| 4342 | /* Nonzero if we are searching multibyte string. */ | 4345 | /* Nonzero if we are searching multibyte string. */ |
| 4343 | const boolean multibyte = RE_TARGET_MULTIBYTE_P (bufp); | 4346 | const boolean multibyte = RE_TARGET_MULTIBYTE_P (bufp); |
| @@ -4385,7 +4388,7 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const | |||
| 4385 | #ifdef emacs | 4388 | #ifdef emacs |
| 4386 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ | 4389 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ |
| 4387 | { | 4390 | { |
| 4388 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos)); | 4391 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos)); |
| 4389 | 4392 | ||
| 4390 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); | 4393 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); |
| 4391 | } | 4394 | } |
| @@ -4420,7 +4423,7 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const | |||
| 4420 | if (range > 0) /* Searching forwards. */ | 4423 | if (range > 0) /* Searching forwards. */ |
| 4421 | { | 4424 | { |
| 4422 | register int lim = 0; | 4425 | register int lim = 0; |
| 4423 | int irange = range; | 4426 | ssize_t irange = range; |
| 4424 | 4427 | ||
| 4425 | if (startpos < size1 && startpos + range >= size1) | 4428 | if (startpos < size1 && startpos + range >= size1) |
| 4426 | lim = range - (size1 - startpos); | 4429 | lim = range - (size1 - startpos); |
| @@ -4571,7 +4574,7 @@ WEAK_ALIAS (__re_search_2, re_search_2) | |||
| 4571 | /* Declarations and macros for re_match_2. */ | 4574 | /* Declarations and macros for re_match_2. */ |
| 4572 | 4575 | ||
| 4573 | static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, | 4576 | static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2, |
| 4574 | register int len, | 4577 | register ssize_t len, |
| 4575 | RE_TRANSLATE_TYPE translate, | 4578 | RE_TRANSLATE_TYPE translate, |
| 4576 | const int multibyte)); | 4579 | const int multibyte)); |
| 4577 | 4580 | ||
| @@ -4873,11 +4876,11 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r | |||
| 4873 | && ((p2[2 + idx] & ~ p1[2 + idx]) == 0)))) | 4876 | && ((p2[2 + idx] & ~ p1[2 + idx]) == 0)))) |
| 4874 | break; | 4877 | break; |
| 4875 | 4878 | ||
| 4876 | if (idx == p2[1]) | 4879 | if (idx == p2[1]) |
| 4877 | { | 4880 | { |
| 4878 | DEBUG_PRINT1 (" No match => fast loop.\n"); | 4881 | DEBUG_PRINT1 (" No match => fast loop.\n"); |
| 4879 | return 1; | 4882 | return 1; |
| 4880 | } | 4883 | } |
| 4881 | } | 4884 | } |
| 4882 | } | 4885 | } |
| 4883 | } | 4886 | } |
| @@ -4941,12 +4944,12 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, const re_char *p1, const r | |||
| 4941 | #ifndef emacs /* Emacs never uses this. */ | 4944 | #ifndef emacs /* Emacs never uses this. */ |
| 4942 | /* re_match is like re_match_2 except it takes only a single string. */ | 4945 | /* re_match is like re_match_2 except it takes only a single string. */ |
| 4943 | 4946 | ||
| 4944 | int | 4947 | regoff_t |
| 4945 | re_match (struct re_pattern_buffer *bufp, const char *string, | 4948 | re_match (struct re_pattern_buffer *bufp, const char *string, |
| 4946 | int size, int pos, struct re_registers *regs) | 4949 | size_t size, ssize_t pos, struct re_registers *regs) |
| 4947 | { | 4950 | { |
| 4948 | int result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, size, | 4951 | regoff_t result = re_match_2_internal (bufp, NULL, 0, (re_char*) string, |
| 4949 | pos, regs, size); | 4952 | size, pos, regs, size); |
| 4950 | return result; | 4953 | return result; |
| 4951 | } | 4954 | } |
| 4952 | WEAK_ALIAS (__re_match, re_match) | 4955 | WEAK_ALIAS (__re_match, re_match) |
| @@ -4971,13 +4974,15 @@ Lisp_Object re_match_object; | |||
| 4971 | failure stack overflowing). Otherwise, we return the length of the | 4974 | failure stack overflowing). Otherwise, we return the length of the |
| 4972 | matched substring. */ | 4975 | matched substring. */ |
| 4973 | 4976 | ||
| 4974 | int | 4977 | regoff_t |
| 4975 | re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int size1, const char *string2, int size2, int pos, struct re_registers *regs, int stop) | 4978 | re_match_2 (struct re_pattern_buffer *bufp, const char *string1, |
| 4979 | size_t size1, const char *string2, size_t size2, ssize_t pos, | ||
| 4980 | struct re_registers *regs, ssize_t stop) | ||
| 4976 | { | 4981 | { |
| 4977 | int result; | 4982 | regoff_t result; |
| 4978 | 4983 | ||
| 4979 | #ifdef emacs | 4984 | #ifdef emacs |
| 4980 | int charpos; | 4985 | ssize_t charpos; |
| 4981 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ | 4986 | gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */ |
| 4982 | charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos)); | 4987 | charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos)); |
| 4983 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); | 4988 | SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1); |
| @@ -4993,11 +4998,13 @@ WEAK_ALIAS (__re_match_2, re_match_2) | |||
| 4993 | 4998 | ||
| 4994 | /* This is a separate function so that we can force an alloca cleanup | 4999 | /* This is a separate function so that we can force an alloca cleanup |
| 4995 | afterwards. */ | 5000 | afterwards. */ |
| 4996 | static int | 5001 | static regoff_t |
| 4997 | re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int size1, const re_char *string2, int size2, int pos, struct re_registers *regs, int stop) | 5002 | re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, |
| 5003 | size_t size1, const re_char *string2, size_t size2, | ||
| 5004 | ssize_t pos, struct re_registers *regs, ssize_t stop) | ||
| 4998 | { | 5005 | { |
| 4999 | /* General temporaries. */ | 5006 | /* General temporaries. */ |
| 5000 | int mcnt; | 5007 | ssize_t mcnt; |
| 5001 | size_t reg; | 5008 | size_t reg; |
| 5002 | 5009 | ||
| 5003 | /* Just past the end of the corresponding string. */ | 5010 | /* Just past the end of the corresponding string. */ |
| @@ -5996,8 +6003,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 5996 | int s1, s2; | 6003 | int s1, s2; |
| 5997 | int dummy; | 6004 | int dummy; |
| 5998 | #ifdef emacs | 6005 | #ifdef emacs |
| 5999 | int offset = PTR_TO_OFFSET (d - 1); | 6006 | ssize_t offset = PTR_TO_OFFSET (d - 1); |
| 6000 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6007 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6001 | UPDATE_SYNTAX_TABLE (charpos); | 6008 | UPDATE_SYNTAX_TABLE (charpos); |
| 6002 | #endif | 6009 | #endif |
| 6003 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 6010 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| @@ -6038,8 +6045,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6038 | int s1, s2; | 6045 | int s1, s2; |
| 6039 | int dummy; | 6046 | int dummy; |
| 6040 | #ifdef emacs | 6047 | #ifdef emacs |
| 6041 | int offset = PTR_TO_OFFSET (d); | 6048 | ssize_t offset = PTR_TO_OFFSET (d); |
| 6042 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6049 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6043 | UPDATE_SYNTAX_TABLE (charpos); | 6050 | UPDATE_SYNTAX_TABLE (charpos); |
| 6044 | #endif | 6051 | #endif |
| 6045 | PREFETCH (); | 6052 | PREFETCH (); |
| @@ -6083,8 +6090,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6083 | int s1, s2; | 6090 | int s1, s2; |
| 6084 | int dummy; | 6091 | int dummy; |
| 6085 | #ifdef emacs | 6092 | #ifdef emacs |
| 6086 | int offset = PTR_TO_OFFSET (d) - 1; | 6093 | ssize_t offset = PTR_TO_OFFSET (d) - 1; |
| 6087 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6094 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6088 | UPDATE_SYNTAX_TABLE (charpos); | 6095 | UPDATE_SYNTAX_TABLE (charpos); |
| 6089 | #endif | 6096 | #endif |
| 6090 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 6097 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| @@ -6127,8 +6134,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6127 | re_wchar_t c1, c2; | 6134 | re_wchar_t c1, c2; |
| 6128 | int s1, s2; | 6135 | int s1, s2; |
| 6129 | #ifdef emacs | 6136 | #ifdef emacs |
| 6130 | int offset = PTR_TO_OFFSET (d); | 6137 | ssize_t offset = PTR_TO_OFFSET (d); |
| 6131 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6138 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6132 | UPDATE_SYNTAX_TABLE (charpos); | 6139 | UPDATE_SYNTAX_TABLE (charpos); |
| 6133 | #endif | 6140 | #endif |
| 6134 | PREFETCH (); | 6141 | PREFETCH (); |
| @@ -6170,8 +6177,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6170 | re_wchar_t c1, c2; | 6177 | re_wchar_t c1, c2; |
| 6171 | int s1, s2; | 6178 | int s1, s2; |
| 6172 | #ifdef emacs | 6179 | #ifdef emacs |
| 6173 | int offset = PTR_TO_OFFSET (d) - 1; | 6180 | ssize_t offset = PTR_TO_OFFSET (d) - 1; |
| 6174 | int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6181 | ssize_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6175 | UPDATE_SYNTAX_TABLE (charpos); | 6182 | UPDATE_SYNTAX_TABLE (charpos); |
| 6176 | #endif | 6183 | #endif |
| 6177 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); | 6184 | GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); |
| @@ -6207,8 +6214,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6207 | PREFETCH (); | 6214 | PREFETCH (); |
| 6208 | #ifdef emacs | 6215 | #ifdef emacs |
| 6209 | { | 6216 | { |
| 6210 | int offset = PTR_TO_OFFSET (d); | 6217 | ssize_t offset = PTR_TO_OFFSET (d); |
| 6211 | int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); | 6218 | ssize_t pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); |
| 6212 | UPDATE_SYNTAX_TABLE (pos1); | 6219 | UPDATE_SYNTAX_TABLE (pos1); |
| 6213 | } | 6220 | } |
| 6214 | #endif | 6221 | #endif |
| @@ -6331,7 +6338,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int | |||
| 6331 | bytes; nonzero otherwise. */ | 6338 | bytes; nonzero otherwise. */ |
| 6332 | 6339 | ||
| 6333 | static int | 6340 | static int |
| 6334 | bcmp_translate (const re_char *s1, const re_char *s2, register int len, | 6341 | bcmp_translate (const re_char *s1, const re_char *s2, register ssize_t len, |
| 6335 | RE_TRANSLATE_TYPE translate, const int target_multibyte) | 6342 | RE_TRANSLATE_TYPE translate, const int target_multibyte) |
| 6336 | { | 6343 | { |
| 6337 | register re_char *p1 = s1, *p2 = s2; | 6344 | register re_char *p1 = s1, *p2 = s2; |
| @@ -6373,7 +6380,8 @@ bcmp_translate (const re_char *s1, const re_char *s2, register int len, | |||
| 6373 | We call regex_compile to do the actual compilation. */ | 6380 | We call regex_compile to do the actual compilation. */ |
| 6374 | 6381 | ||
| 6375 | const char * | 6382 | const char * |
| 6376 | re_compile_pattern (const char *pattern, size_t length, struct re_pattern_buffer *bufp) | 6383 | re_compile_pattern (const char *pattern, size_t length, |
| 6384 | struct re_pattern_buffer *bufp) | ||
| 6377 | { | 6385 | { |
| 6378 | reg_errcode_t ret; | 6386 | reg_errcode_t ret; |
| 6379 | 6387 | ||
| @@ -6449,14 +6457,13 @@ re_comp (s) | |||
| 6449 | } | 6457 | } |
| 6450 | 6458 | ||
| 6451 | 6459 | ||
| 6452 | int | 6460 | regoff_t |
| 6453 | # ifdef _LIBC | 6461 | # ifdef _LIBC |
| 6454 | weak_function | 6462 | weak_function |
| 6455 | # endif | 6463 | # endif |
| 6456 | re_exec (s) | 6464 | re_exec (const char *s) |
| 6457 | const char *s; | ||
| 6458 | { | 6465 | { |
| 6459 | const int len = strlen (s); | 6466 | const size_t len = strlen (s); |
| 6460 | return | 6467 | return |
| 6461 | 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); | 6468 | 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); |
| 6462 | } | 6469 | } |
| @@ -6500,7 +6507,7 @@ re_exec (s) | |||
| 6500 | It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for | 6507 | It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for |
| 6501 | the return codes and their meanings.) */ | 6508 | the return codes and their meanings.) */ |
| 6502 | 6509 | ||
| 6503 | int | 6510 | reg_errcode_t |
| 6504 | regcomp (regex_t *__restrict preg, const char *__restrict pattern, | 6511 | regcomp (regex_t *__restrict preg, const char *__restrict pattern, |
| 6505 | int cflags) | 6512 | int cflags) |
| 6506 | { | 6513 | { |
| @@ -6564,7 +6571,7 @@ regcomp (regex_t *__restrict preg, const char *__restrict pattern, | |||
| 6564 | preg->fastmap = NULL; | 6571 | preg->fastmap = NULL; |
| 6565 | } | 6572 | } |
| 6566 | } | 6573 | } |
| 6567 | return (int) ret; | 6574 | return ret; |
| 6568 | } | 6575 | } |
| 6569 | WEAK_ALIAS (__regcomp, regcomp) | 6576 | WEAK_ALIAS (__regcomp, regcomp) |
| 6570 | 6577 | ||
| @@ -6583,14 +6590,14 @@ WEAK_ALIAS (__regcomp, regcomp) | |||
| 6583 | 6590 | ||
| 6584 | We return 0 if we find a match and REG_NOMATCH if not. */ | 6591 | We return 0 if we find a match and REG_NOMATCH if not. */ |
| 6585 | 6592 | ||
| 6586 | int | 6593 | reg_errcode_t |
| 6587 | regexec (const regex_t *__restrict preg, const char *__restrict string, | 6594 | regexec (const regex_t *__restrict preg, const char *__restrict string, |
| 6588 | size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) | 6595 | size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) |
| 6589 | { | 6596 | { |
| 6590 | int ret; | 6597 | reg_errcode_t ret; |
| 6591 | struct re_registers regs; | 6598 | struct re_registers regs; |
| 6592 | regex_t private_preg; | 6599 | regex_t private_preg; |
| 6593 | int len = strlen (string); | 6600 | size_t len = strlen (string); |
| 6594 | boolean want_reg_info = !preg->no_sub && nmatch > 0 && pmatch; | 6601 | boolean want_reg_info = !preg->no_sub && nmatch > 0 && pmatch; |
| 6595 | 6602 | ||
| 6596 | private_preg = *preg; | 6603 | private_preg = *preg; |
| @@ -6608,7 +6615,7 @@ regexec (const regex_t *__restrict preg, const char *__restrict string, | |||
| 6608 | regs.num_regs = nmatch; | 6615 | regs.num_regs = nmatch; |
| 6609 | regs.start = TALLOC (nmatch * 2, regoff_t); | 6616 | regs.start = TALLOC (nmatch * 2, regoff_t); |
| 6610 | if (regs.start == NULL) | 6617 | if (regs.start == NULL) |
| 6611 | return (int) REG_NOMATCH; | 6618 | return REG_NOMATCH; |
| 6612 | regs.end = regs.start + nmatch; | 6619 | regs.end = regs.start + nmatch; |
| 6613 | } | 6620 | } |
| 6614 | 6621 | ||
| @@ -6645,7 +6652,7 @@ regexec (const regex_t *__restrict preg, const char *__restrict string, | |||
| 6645 | } | 6652 | } |
| 6646 | 6653 | ||
| 6647 | /* We want zero return to mean success, unlike `re_search'. */ | 6654 | /* We want zero return to mean success, unlike `re_search'. */ |
| 6648 | return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; | 6655 | return ret >= 0 ? REG_NOERROR : REG_NOMATCH; |
| 6649 | } | 6656 | } |
| 6650 | WEAK_ALIAS (__regexec, regexec) | 6657 | WEAK_ALIAS (__regexec, regexec) |
| 6651 | 6658 | ||
diff --git a/src/regex.h b/src/regex.h index 990606da4cc..7747ec57629 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -414,8 +414,12 @@ struct re_pattern_buffer | |||
| 414 | 414 | ||
| 415 | typedef struct re_pattern_buffer regex_t; | 415 | typedef struct re_pattern_buffer regex_t; |
| 416 | 416 | ||
| 417 | /* Type for byte offsets within the string. POSIX mandates this. */ | 417 | /* Type for byte offsets within the string. POSIX mandates this to be an int, |
| 418 | typedef int regoff_t; | 418 | but the Open Group has signalled its intention to change the requirement to |
| 419 | be that regoff_t be at least as wide as ptrdiff_t and ssize_t. Current | ||
| 420 | gnulib sources also use ssize_t, and we need this for supporting buffers and | ||
| 421 | strings > 2GB on 64-bit hosts. */ | ||
| 422 | typedef ssize_t regoff_t; | ||
| 419 | 423 | ||
| 420 | 424 | ||
| 421 | /* This is the structure we store register match data in. See | 425 | /* This is the structure we store register match data in. See |
| @@ -486,31 +490,33 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer)); | |||
| 486 | characters. Return the starting position of the match, -1 for no | 490 | characters. Return the starting position of the match, -1 for no |
| 487 | match, or -2 for an internal error. Also return register | 491 | match, or -2 for an internal error. Also return register |
| 488 | information in REGS (if REGS and BUFFER->no_sub are nonzero). */ | 492 | information in REGS (if REGS and BUFFER->no_sub are nonzero). */ |
| 489 | extern int re_search | 493 | extern regoff_t re_search |
| 490 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, | 494 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, |
| 491 | int length, int start, int range, struct re_registers *regs)); | 495 | size_t length, ssize_t start, ssize_t range, |
| 496 | struct re_registers *regs)); | ||
| 492 | 497 | ||
| 493 | 498 | ||
| 494 | /* Like `re_search', but search in the concatenation of STRING1 and | 499 | /* Like `re_search', but search in the concatenation of STRING1 and |
| 495 | STRING2. Also, stop searching at index START + STOP. */ | 500 | STRING2. Also, stop searching at index START + STOP. */ |
| 496 | extern int re_search_2 | 501 | extern regoff_t re_search_2 |
| 497 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, | 502 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
| 498 | int length1, const char *string2, int length2, | 503 | size_t length1, const char *string2, size_t length2, |
| 499 | int start, int range, struct re_registers *regs, int stop)); | 504 | ssize_t start, ssize_t range, struct re_registers *regs, |
| 505 | ssize_t stop)); | ||
| 500 | 506 | ||
| 501 | 507 | ||
| 502 | /* Like `re_search', but return how many characters in STRING the regexp | 508 | /* Like `re_search', but return how many characters in STRING the regexp |
| 503 | in BUFFER matched, starting at position START. */ | 509 | in BUFFER matched, starting at position START. */ |
| 504 | extern int re_match | 510 | extern regoff_t re_match |
| 505 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, | 511 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string, |
| 506 | int length, int start, struct re_registers *regs)); | 512 | size_t length, ssize_t start, struct re_registers *regs)); |
| 507 | 513 | ||
| 508 | 514 | ||
| 509 | /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ | 515 | /* Relates to `re_match' as `re_search_2' relates to `re_search'. */ |
| 510 | extern int re_match_2 | 516 | extern regoff_t re_match_2 |
| 511 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, | 517 | _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1, |
| 512 | int length1, const char *string2, int length2, | 518 | size_t length1, const char *string2, size_t length2, |
| 513 | int start, struct re_registers *regs, int stop)); | 519 | ssize_t start, struct re_registers *regs, ssize_t stop)); |
| 514 | 520 | ||
| 515 | 521 | ||
| 516 | /* Set REGS to hold NUM_REGS registers, storing them in STARTS and | 522 | /* Set REGS to hold NUM_REGS registers, storing them in STARTS and |
| @@ -556,14 +562,15 @@ extern int re_exec _RE_ARGS ((const char *)); | |||
| 556 | #endif | 562 | #endif |
| 557 | 563 | ||
| 558 | /* POSIX compatibility. */ | 564 | /* POSIX compatibility. */ |
| 559 | extern int regcomp _RE_ARGS ((regex_t *__restrict __preg, | 565 | extern reg_errcode_t regcomp _RE_ARGS ((regex_t *__restrict __preg, |
| 560 | const char *__restrict __pattern, | 566 | const char *__restrict __pattern, |
| 561 | int __cflags)); | 567 | int __cflags)); |
| 562 | 568 | ||
| 563 | extern int regexec _RE_ARGS ((const regex_t *__restrict __preg, | 569 | extern reg_errcode_t regexec _RE_ARGS ((const regex_t *__restrict __preg, |
| 564 | const char *__restrict __string, size_t __nmatch, | 570 | const char *__restrict __string, |
| 565 | regmatch_t __pmatch[__restrict_arr], | 571 | size_t __nmatch, |
| 566 | int __eflags)); | 572 | regmatch_t __pmatch[__restrict_arr], |
| 573 | int __eflags)); | ||
| 567 | 574 | ||
| 568 | extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, | 575 | extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg, |
| 569 | char *__errbuf, size_t __errbuf_size)); | 576 | char *__errbuf, size_t __errbuf_size)); |
diff --git a/src/syntax.c b/src/syntax.c index 031409144b1..4be6b8db140 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -175,7 +175,7 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */ | |||
| 175 | start/end of OBJECT. */ | 175 | start/end of OBJECT. */ |
| 176 | 176 | ||
| 177 | void | 177 | void |
| 178 | update_syntax_table (EMACS_INT charpos, int count, int init, | 178 | update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init, |
| 179 | Lisp_Object object) | 179 | Lisp_Object object) |
| 180 | { | 180 | { |
| 181 | Lisp_Object tmp_table; | 181 | Lisp_Object tmp_table; |
diff --git a/src/syntax.h b/src/syntax.h index 2b052715dac..9f328f568c7 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License | |||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | extern void update_syntax_table (EMACS_INT, int, int, Lisp_Object); | 22 | extern void update_syntax_table (EMACS_INT, EMACS_INT, int, Lisp_Object); |
| 23 | 23 | ||
| 24 | /* The standard syntax table is stored where it will automatically | 24 | /* The standard syntax table is stored where it will automatically |
| 25 | be used in all new buffers. */ | 25 | be used in all new buffers. */ |
| @@ -276,15 +276,15 @@ while (0) | |||
| 276 | struct gl_state_s | 276 | struct gl_state_s |
| 277 | { | 277 | { |
| 278 | Lisp_Object object; /* The object we are scanning. */ | 278 | Lisp_Object object; /* The object we are scanning. */ |
| 279 | int start; /* Where to stop. */ | 279 | EMACS_INT start; /* Where to stop. */ |
| 280 | int stop; /* Where to stop. */ | 280 | EMACS_INT stop; /* Where to stop. */ |
| 281 | int use_global; /* Whether to use global_code | 281 | int use_global; /* Whether to use global_code |
| 282 | or c_s_t. */ | 282 | or c_s_t. */ |
| 283 | Lisp_Object global_code; /* Syntax code of current char. */ | 283 | Lisp_Object global_code; /* Syntax code of current char. */ |
| 284 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ | 284 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ |
| 285 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ | 285 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ |
| 286 | int b_property; /* First index where c_s_t is valid. */ | 286 | EMACS_INT b_property; /* First index where c_s_t is valid. */ |
| 287 | int e_property; /* First index where c_s_t is | 287 | EMACS_INT e_property; /* First index where c_s_t is |
| 288 | not valid. */ | 288 | not valid. */ |
| 289 | INTERVAL forward_i; /* Where to start lookup on forward */ | 289 | INTERVAL forward_i; /* Where to start lookup on forward */ |
| 290 | INTERVAL backward_i; /* or backward movement. The | 290 | INTERVAL backward_i; /* or backward movement. The |
| @@ -294,7 +294,7 @@ struct gl_state_s | |||
| 294 | intervals too, depending | 294 | intervals too, depending |
| 295 | on: */ | 295 | on: */ |
| 296 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ | 296 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ |
| 297 | int offset; | 297 | EMACS_INT offset; |
| 298 | }; | 298 | }; |
| 299 | 299 | ||
| 300 | extern struct gl_state_s gl_state; | 300 | extern struct gl_state_s gl_state; |
diff --git a/src/textprop.c b/src/textprop.c index a0d7d2689c4..d9da36bf36b 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -514,7 +514,7 @@ erase_properties (INTERVAL i) | |||
| 514 | POSITION is BEG-based. */ | 514 | POSITION is BEG-based. */ |
| 515 | 515 | ||
| 516 | INTERVAL | 516 | INTERVAL |
| 517 | interval_of (int position, Lisp_Object object) | 517 | interval_of (EMACS_INT position, Lisp_Object object) |
| 518 | { | 518 | { |
| 519 | register INTERVAL i; | 519 | register INTERVAL i; |
| 520 | EMACS_INT beg, end; | 520 | EMACS_INT beg, end; |
| @@ -2012,7 +2012,8 @@ call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end) | |||
| 2012 | those hooks in order, with START and END - 1 as arguments. */ | 2012 | those hooks in order, with START and END - 1 as arguments. */ |
| 2013 | 2013 | ||
| 2014 | void | 2014 | void |
| 2015 | verify_interval_modification (struct buffer *buf, int start, int end) | 2015 | verify_interval_modification (struct buffer *buf, |
| 2016 | EMACS_INT start, EMACS_INT end) | ||
| 2016 | { | 2017 | { |
| 2017 | register INTERVAL intervals = BUF_INTERVALS (buf); | 2018 | register INTERVAL intervals = BUF_INTERVALS (buf); |
| 2018 | register INTERVAL i; | 2019 | register INTERVAL i; |