diff options
| author | Paul Eggert | 2016-04-04 17:04:58 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-04 17:05:19 -0700 |
| commit | b4c7869e5e1bb0bb33379b25ff830e721761a7bf (patch) | |
| tree | 07b81f9711ea7188421c2ac2303b442778b6c980 /src/process.c | |
| parent | 3c623c26ae7d695746e05d8a2e16a67a6256b024 (diff) | |
| download | emacs-b4c7869e5e1bb0bb33379b25ff830e721761a7bf.tar.gz emacs-b4c7869e5e1bb0bb33379b25ff830e721761a7bf.zip | |
Prefer AUTO_STRING_WITH_LEN to make_formatted_string
* src/buffer.c (Fgenerate_new_buffer_name):
* src/filelock.c (get_boot_time):
* src/minibuf.c (get_minibuffer):
* src/process.c (make_process):
* src/xdisp.c (ensure_echo_area_buffers):
Prefer AUTO_STRING_WITH_LEN + sprintf to make_formatted_string
when either will do.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/process.c b/src/process.c index 399cd8accde..a006ca61ac5 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -675,12 +675,7 @@ allocate_process (void) | |||
| 675 | static Lisp_Object | 675 | static Lisp_Object |
| 676 | make_process (Lisp_Object name) | 676 | make_process (Lisp_Object name) |
| 677 | { | 677 | { |
| 678 | register Lisp_Object val, tem, name1; | 678 | struct Lisp_Process *p = allocate_process (); |
| 679 | register struct Lisp_Process *p; | ||
| 680 | char suffix[sizeof "<>" + INT_STRLEN_BOUND (printmax_t)]; | ||
| 681 | printmax_t i; | ||
| 682 | |||
| 683 | p = allocate_process (); | ||
| 684 | /* Initialize Lisp data. Note that allocate_process initializes all | 679 | /* Initialize Lisp data. Note that allocate_process initializes all |
| 685 | Lisp data to nil, so do it only for slots which should not be nil. */ | 680 | Lisp data to nil, so do it only for slots which should not be nil. */ |
| 686 | pset_status (p, Qrun); | 681 | pset_status (p, Qrun); |
| @@ -690,7 +685,7 @@ make_process (Lisp_Object name) | |||
| 690 | non-Lisp data, so do it only for slots which should not be zero. */ | 685 | non-Lisp data, so do it only for slots which should not be zero. */ |
| 691 | p->infd = -1; | 686 | p->infd = -1; |
| 692 | p->outfd = -1; | 687 | p->outfd = -1; |
| 693 | for (i = 0; i < PROCESS_OPEN_FDS; i++) | 688 | for (int i = 0; i < PROCESS_OPEN_FDS; i++) |
| 694 | p->open_fd[i] = -1; | 689 | p->open_fd[i] = -1; |
| 695 | 690 | ||
| 696 | #ifdef HAVE_GNUTLS | 691 | #ifdef HAVE_GNUTLS |
| @@ -700,17 +695,22 @@ make_process (Lisp_Object name) | |||
| 700 | 695 | ||
| 701 | /* If name is already in use, modify it until it is unused. */ | 696 | /* If name is already in use, modify it until it is unused. */ |
| 702 | 697 | ||
| 703 | name1 = name; | 698 | Lisp_Object name1 = name; |
| 704 | for (i = 1; ; i++) | 699 | for (printmax_t i = 1; ; i++) |
| 705 | { | 700 | { |
| 706 | tem = Fget_process (name1); | 701 | Lisp_Object tem = Fget_process (name1); |
| 707 | if (NILP (tem)) break; | 702 | if (NILP (tem)) |
| 708 | name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); | 703 | break; |
| 704 | char const suffix_fmt[] = "<%"pMd">"; | ||
| 705 | char suffix[sizeof suffix_fmt + INT_STRLEN_BOUND (printmax_t)]; | ||
| 706 | AUTO_STRING_WITH_LEN (lsuffix, suffix, sprintf (suffix, suffix_fmt, i)); | ||
| 707 | name1 = concat2 (name, lsuffix); | ||
| 709 | } | 708 | } |
| 710 | name = name1; | 709 | name = name1; |
| 711 | pset_name (p, name); | 710 | pset_name (p, name); |
| 712 | pset_sentinel (p, Qinternal_default_process_sentinel); | 711 | pset_sentinel (p, Qinternal_default_process_sentinel); |
| 713 | pset_filter (p, Qinternal_default_process_filter); | 712 | pset_filter (p, Qinternal_default_process_filter); |
| 713 | Lisp_Object val; | ||
| 714 | XSETPROCESS (val, p); | 714 | XSETPROCESS (val, p); |
| 715 | Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); | 715 | Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); |
| 716 | return val; | 716 | return val; |