aboutsummaryrefslogtreecommitdiffstats
path: root/src/atimer.c
diff options
context:
space:
mode:
authorPaul Eggert2011-03-17 23:48:05 -0700
committerPaul Eggert2011-03-17 23:48:05 -0700
commit3e7d65943519072e22cb3bcff3897805f5bae7a8 (patch)
tree8c63d5ea2e1730781b30d74aa38d0a838a3b1b2c /src/atimer.c
parent8176119bc432d0ddb6187a4a84c81a7d9489153a (diff)
downloademacs-3e7d65943519072e22cb3bcff3897805f5bae7a8.tar.gz
emacs-3e7d65943519072e22cb3bcff3897805f5bae7a8.zip
* atimer.c (start_atimer, append_atimer_lists, set_alarm): Rename
locals to avoid shadowing.
Diffstat (limited to 'src/atimer.c')
-rw-r--r--src/atimer.c47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/atimer.c b/src/atimer.c
index 309a4eaee4f..e10add961eb 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -86,7 +86,7 @@ SIGTYPE alarm_signal_handler (int signo);
86 to cancel_atimer; don't free it yourself. */ 86 to cancel_atimer; don't free it yourself. */
87 87
88struct atimer * 88struct atimer *
89start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn, 89start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
90 void *client_data) 90 void *client_data)
91{ 91{
92 struct atimer *t; 92 struct atimer *t;
@@ -94,10 +94,10 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
94 /* Round TIME up to the next full second if we don't have 94 /* Round TIME up to the next full second if we don't have
95 itimers. */ 95 itimers. */
96#ifndef HAVE_SETITIMER 96#ifndef HAVE_SETITIMER
97 if (EMACS_USECS (time) != 0) 97 if (EMACS_USECS (timestamp) != 0)
98 { 98 {
99 EMACS_SET_USECS (time, 0); 99 EMACS_SET_USECS (timestamp, 0);
100 EMACS_SET_SECS (time, EMACS_SECS (time) + 1); 100 EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1);
101 } 101 }
102#endif /* not HAVE_SETITIMER */ 102#endif /* not HAVE_SETITIMER */
103 103
@@ -123,18 +123,18 @@ start_atimer (enum atimer_type type, EMACS_TIME time, atimer_callback fn,
123 switch (type) 123 switch (type)
124 { 124 {
125 case ATIMER_ABSOLUTE: 125 case ATIMER_ABSOLUTE:
126 t->expiration = time; 126 t->expiration = timestamp;
127 break; 127 break;
128 128
129 case ATIMER_RELATIVE: 129 case ATIMER_RELATIVE:
130 EMACS_GET_TIME (t->expiration); 130 EMACS_GET_TIME (t->expiration);
131 EMACS_ADD_TIME (t->expiration, t->expiration, time); 131 EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
132 break; 132 break;
133 133
134 case ATIMER_CONTINUOUS: 134 case ATIMER_CONTINUOUS:
135 EMACS_GET_TIME (t->expiration); 135 EMACS_GET_TIME (t->expiration);
136 EMACS_ADD_TIME (t->expiration, t->expiration, time); 136 EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
137 t->interval = time; 137 t->interval = timestamp;
138 break; 138 break;
139 } 139 }
140 140
@@ -187,24 +187,24 @@ cancel_atimer (struct atimer *timer)
187} 187}
188 188
189 189
190/* Append two lists of atimers LIST1 and LIST2 and return the 190/* Append two lists of atimers LIST_1 and LIST_2 and return the
191 result list. */ 191 result list. */
192 192
193static struct atimer * 193static struct atimer *
194append_atimer_lists (struct atimer *list1, struct atimer *list2) 194append_atimer_lists (struct atimer *list_1, struct atimer *list_2)
195{ 195{
196 if (list1 == NULL) 196 if (list_1 == NULL)
197 return list2; 197 return list_2;
198 else if (list2 == NULL) 198 else if (list_2 == NULL)
199 return list1; 199 return list_1;
200 else 200 else
201 { 201 {
202 struct atimer *p; 202 struct atimer *p;
203 203
204 for (p = list1; p->next; p = p->next) 204 for (p = list_1; p->next; p = p->next)
205 ; 205 ;
206 p->next = list2; 206 p->next = list_2;
207 return list1; 207 return list_1;
208 } 208 }
209} 209}
210 210
@@ -287,28 +287,28 @@ set_alarm (void)
287{ 287{
288 if (atimers) 288 if (atimers)
289 { 289 {
290 EMACS_TIME now, time; 290 EMACS_TIME now, timestamp;
291#ifdef HAVE_SETITIMER 291#ifdef HAVE_SETITIMER
292 struct itimerval it; 292 struct itimerval it;
293#endif 293#endif
294 294
295 /* Determine s/us till the next timer is ripe. */ 295 /* Determine s/us till the next timer is ripe. */
296 EMACS_GET_TIME (now); 296 EMACS_GET_TIME (now);
297 EMACS_SUB_TIME (time, atimers->expiration, now); 297 EMACS_SUB_TIME (timestamp, atimers->expiration, now);
298 298
299#ifdef HAVE_SETITIMER 299#ifdef HAVE_SETITIMER
300 /* Don't set the interval to 0; this disables the timer. */ 300 /* Don't set the interval to 0; this disables the timer. */
301 if (EMACS_TIME_LE (atimers->expiration, now)) 301 if (EMACS_TIME_LE (atimers->expiration, now))
302 { 302 {
303 EMACS_SET_SECS (time, 0); 303 EMACS_SET_SECS (timestamp, 0);
304 EMACS_SET_USECS (time, 1000); 304 EMACS_SET_USECS (timestamp, 1000);
305 } 305 }
306 306
307 memset (&it, 0, sizeof it); 307 memset (&it, 0, sizeof it);
308 it.it_value = time; 308 it.it_value = timestamp;
309 setitimer (ITIMER_REAL, &it, 0); 309 setitimer (ITIMER_REAL, &it, 0);
310#else /* not HAVE_SETITIMER */ 310#else /* not HAVE_SETITIMER */
311 alarm (max (EMACS_SECS (time), 1)); 311 alarm (max (EMACS_SECS (timestamp), 1));
312#endif /* not HAVE_SETITIMER */ 312#endif /* not HAVE_SETITIMER */
313 } 313 }
314} 314}
@@ -442,4 +442,3 @@ init_atimer (void)
442 /* pending_signals is initialized in init_keyboard.*/ 442 /* pending_signals is initialized in init_keyboard.*/
443 signal (SIGALRM, alarm_signal_handler); 443 signal (SIGALRM, alarm_signal_handler);
444} 444}
445