Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/HACKING
diff options
context:
space:
mode:
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING59
1 files changed, 57 insertions, 2 deletions
diff --git a/HACKING b/HACKING
index 6692f7e8..e859bd86 100644
--- a/HACKING
+++ b/HACKING
@@ -90,6 +90,61 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
NOT
if(!strcmp(a, b))
+8. Use spaces around almost all arithmetic, comparison and assignment
+ operators and after all ',;:' separators.
+
+ foobar[2 * size + 1] = function(a, 6);
+ NOT
+ foobar[2*size+1]=function(a,6);
+
+ for(a = 0; a < n && n > 0; a++,n--) {}
+ NOT
+ for(a=0;a<n&&n>0;a++,n--) {}
+
+9. Declare all variables at the start of the block.
+[source,C]
+-------------------------------------------
+int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
+{
+ char *newurl, *vdata = NULL;
+
+ newurl = url;
+ if(!newurl) {
+ return -1;
+ }
+
+ ...
+
+ if(vdata) {
+ ...
+ }
+
+ return 1;
+}
+-------------------------------------------
+
+ NOT
+
+[source,C]
+-------------------------------------------
+int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
+{
+ char *newurl = url;
+
+ if(!newurl) {
+ return -1;
+ }
+
+ char *vdata = NULL;
+
+ if(vdata) {
+ ...
+ }
+
+ return 1;
+}
+-------------------------------------------
+
Other Concerns
--------------
@@ -103,8 +158,6 @@ general pattern, including blank lines:
[source,C]
-------------------------------------------
-#include "config.h"
-
#include <standardheader.h>
#include <another.h>
#include <...>
@@ -133,6 +186,8 @@ For pacman:
#include "anythingelse.h"
-------------------------------------------
+Never directly include config.h. This will always be added via Makefiles.
+
GDB and Valgrind Usage
~~~~~~~~~~~~~~~~~~~~~~