Re: svn commit: r228323 - head/lib/libc/stdlib

2011-12-07 Thread Bruce Evans

On Wed, 7 Dec 2011, David Chisnall wrote:


Log:
 style(9) cleanups.


Thanks, but many style bugs are still visible.


Modified: head/lib/libc/stdlib/quick_exit.c
==
--- head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 15:25:48 2011
(r228322)
+++ head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 16:12:54 2011
(r228323)
...
@@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void))
{
struct quick_exit_handler *h = malloc(sizeof(struct 
quick_exit_handler));


This still has:
- initialization in declaration
- line too long
- sizeof(typename) instead of sizeof(var).  Maybe this is only a style bug
  for me, but for long typename's the verboseness given by sizeof(typename)
  helps implement the previous bug.



-   if (0 == h) {
+   if (NULL == h)


(h == NULL) would be normal.


return 1;


This return is still missing parentheses.


-   }
h->cleanup = func;
pthread_mutex_lock(&atexit_mutex);
h->next = handlers;
handlers = h;
pthread_mutex_unlock(&atexit_mutex);
-   return 0;
+   return (0);


The one is fixed, so now the style for returns in this file is internally
inconsistent.

Bruce
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r228323 - head/lib/libc/stdlib

2011-12-07 Thread David Chisnall
Author: theraven
Date: Wed Dec  7 16:12:54 2011
New Revision: 228323
URL: http://svn.freebsd.org/changeset/base/228323

Log:
  style(9) cleanups.
  
  Approved by:  brooks (mentor)

Modified:
  head/lib/libc/stdlib/quick_exit.c

Modified: head/lib/libc/stdlib/quick_exit.c
==
--- head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 15:25:48 2011
(r228322)
+++ head/lib/libc/stdlib/quick_exit.c   Wed Dec  7 16:12:54 2011
(r228323)
@@ -39,9 +39,6 @@ struct quick_exit_handler {
void (*cleanup)(void);
 };
 
-__attribute((weak))
-void _ZSt9terminatev(void);
-
 /**
  * Lock protecting the handlers list.
  */
@@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void))
 {
struct quick_exit_handler *h = malloc(sizeof(struct 
quick_exit_handler));
 
-   if (0 == h) {
+   if (NULL == h)
return 1;
-   }
h->cleanup = func;
pthread_mutex_lock(&atexit_mutex);
h->next = handlers;
handlers = h;
pthread_mutex_unlock(&atexit_mutex);
-   return 0;
+   return (0);
 }
 
-void quick_exit(int status)
+void
+quick_exit(int status)
 {
+   struct quick_exit_handler *h;
+
/*
 * XXX: The C++ spec requires us to call std::terminate if there is an
 * exception here.
 */
-   for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next)
-   {
+   for (h = handlers; NULL != h; h = h->next)
h->cleanup();
-   }
_Exit(status);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"