summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>2012-07-31 21:24:31 +0300
committerDan McGee <dan@archlinux.org>2012-08-07 20:56:45 -0500
commit527ae7092d98ff11c10ec92831e1297e33e946cf (patch)
tree6c3b78f33a137c4f15744b146726145f0b4cbee3
parenta50d1bc9ab0dbe312d498de1f24760d172169413 (diff)
added coding standard
Signed-off-by: Barbu Paul - Gheorghe <barbu.paul.gheorghe@gmail.com>
-rw-r--r--HACKING44
1 files changed, 44 insertions, 0 deletions
diff --git a/HACKING b/HACKING
index 8a59344e..e859bd86 100644
--- a/HACKING
+++ b/HACKING
@@ -101,6 +101,50 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
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
--------------