summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/error.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-07-12 13:40:41 +0200
committerJulian Andres Klode <jak@debian.org>2017-07-12 13:57:51 +0200
commit87274d0f22e1dfd99b2e5200e2fe75c1b804eac3 (patch)
treeba3dd14cf899c550ea2e79a696a323bfe8479322 /apt-pkg/contrib/error.cc
parent78fcdd9629022c0c37742614351f5b02fed97607 (diff)
Reformat and sort all includes with clang-format
This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh.
Diffstat (limited to 'apt-pkg/contrib/error.cc')
-rw-r--r--apt-pkg/contrib/error.cc35
1 files changed, 18 insertions, 17 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index c06ea8364..0233dfd59 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -17,17 +17,17 @@
#include <apt-pkg/error.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <list>
+#include <algorithm>
+#include <cstring>
#include <iostream>
+#include <list>
+#include <string>
#include <errno.h>
+#include <stdarg.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <string>
-#include <cstring>
-#include <algorithm>
/*}}}*/
@@ -37,20 +37,21 @@
Per-Thread error object is maintained in much the same manner as libc
manages errno */
#if defined(_POSIX_THREADS) && defined(HAVE_PTHREAD)
- #include <pthread.h>
+#include <pthread.h>
- static pthread_key_t ErrorKey;
- static void ErrorDestroy(void *Obj) {delete (GlobalError *)Obj;};
- static void KeyAlloc() {pthread_key_create(&ErrorKey,ErrorDestroy);};
+static pthread_key_t ErrorKey;
+static void ErrorDestroy(void *Obj) { delete (GlobalError *)Obj; };
+static void KeyAlloc() { pthread_key_create(&ErrorKey, ErrorDestroy); };
- GlobalError *_GetErrorObj() {
- static pthread_once_t Once = PTHREAD_ONCE_INIT;
- pthread_once(&Once,KeyAlloc);
+GlobalError *_GetErrorObj()
+{
+ static pthread_once_t Once = PTHREAD_ONCE_INIT;
+ pthread_once(&Once, KeyAlloc);
- void *Res = pthread_getspecific(ErrorKey);
- if (Res == 0)
- pthread_setspecific(ErrorKey,Res = new GlobalError);
- return (GlobalError *)Res;
+ void *Res = pthread_getspecific(ErrorKey);
+ if (Res == 0)
+ pthread_setspecific(ErrorKey, Res = new GlobalError);
+ return (GlobalError *)Res;
}
#else
GlobalError *_GetErrorObj() {