Browse Source

Formatting

Piotr Czajkowski 6 years ago
parent
commit
45bdd3d8ca
8 changed files with 25 additions and 25 deletions
  1. 1 1
      anonymize.c
  2. 1 1
      comments.c
  3. 3 3
      dict.h
  4. 8 8
      keyval.c
  5. 3 3
      keyval.h
  6. 7 7
      stopif.h
  7. 1 1
      xmlbuff.c
  8. 1 1
      zip.c

+ 1 - 1
anonymize.c

@@ -6,7 +6,7 @@ int main(int argc, char **argv) {
 		printf("Usage: %s <path_to_DOCX>\n", argv[0]);
 		printf("Optionaly provide output file as second argument.\n");
 	}
-		
+
 	if (argc > 2)
 		process(argv[1], argv[2]);
 	else if (argc > 1)

+ 1 - 1
comments.c

@@ -23,7 +23,7 @@ void printAuthors(dictionary *authors) {
 
 int processAuthors(xmlXPathObjectPtr authors) {
 	dictionary *anonAuthors = dictionary_new();
-	
+
 	for (int i=0; i < authors->nodesetval->nodeNr; i++){
 		xmlChar *authorName = (xmlChar*)"";		
 		authorName = xmlNodeGetContent(authors->nodesetval->nodeTab[i]);

+ 3 - 3
dict.h

@@ -4,12 +4,12 @@
 extern void *dictionary_not_found;
 
 typedef struct dictionary{
-   keyval **pairs;
-   int length;
+	keyval **pairs;
+	int length;
 } dictionary;
 
 dictionary *dictionary_new (void);
 dictionary *dictionary_copy(dictionary *in);
 void dictionary_free(dictionary *in);
 void dictionary_add(dictionary *in, char *key, void *value);
-void *dictionary_find(dictionary const *in, char const *key);
+void *dictionary_find(dictionary const *in, char const *key);

+ 8 - 8
keyval.c

@@ -5,17 +5,17 @@
 #include "keyval.h"
 
 keyval *keyval_new(char *key, void *value){
-    keyval *out = malloc(sizeof(keyval));
-    *out = (keyval){.key = strdup(key), .value=strdup(value)};
-    return out;
+	keyval *out = malloc(sizeof(keyval));
+	*out = (keyval){.key = strdup(key), .value=strdup(value)};
+	return out;
 }
 
 /** Copy a key/value pair. The new pair has pointers to
   the values in the old pair, not copies of their data.  */
 keyval *keyval_copy(keyval const *in){
-    keyval *out = malloc(sizeof(keyval));
-    *out = *in;
-    return out;
+	keyval *out = malloc(sizeof(keyval));
+	*out = *in;
+	return out;
 }
 
 void keyval_free(keyval *in){
@@ -25,5 +25,5 @@ void keyval_free(keyval *in){
 }
 
 int keyval_matches(keyval const *in, char const *key){
-    return !strcasecmp(in->key, key);
-}
+	return !strcasecmp(in->key, key);
+}

+ 3 - 3
keyval.h

@@ -1,10 +1,10 @@
 // Borrowed from https://github.com/b-k/21st-Century-Examples
 typedef struct keyval{
-   char *key;
-   void *value;
+	char *key;
+	void *value;
 } keyval;
 
 keyval *keyval_new(char *key, void *value);
 keyval *keyval_copy(keyval const *in);
 void keyval_free(keyval *in);
-int keyval_matches(keyval const *in, char const *key);
+int keyval_matches(keyval const *in, char const *key);

+ 7 - 7
stopif.h

@@ -3,16 +3,16 @@
 #include <stdlib.h> //abort
 
 /** Set this to \c 's' to stop the program on an error.
-    Otherwise, functions return a value on failure.*/
+  Otherwise, functions return a value on failure.*/
 char error_mode;
 
 /** To where should I write errors? If this is \c NULL, write to \c stderr. */
 FILE *error_log;
 
 #define Stopif(assertion, error_action, ...) {                    \
-        if (assertion){                                           \
-            fprintf(error_log ? error_log : stderr, __VA_ARGS__); \
-            fprintf(error_log ? error_log : stderr, "\n");        \
-            if (error_mode=='s') abort();                         \
-            else                 {error_action;}                  \
-        } }
+	if (assertion){                                           \
+		fprintf(error_log ? error_log : stderr, __VA_ARGS__); \
+		fprintf(error_log ? error_log : stderr, "\n");        \
+		if (error_mode=='s') abort();                         \
+		else                 {error_action;}                  \
+	} }

+ 1 - 1
xmlbuff.c

@@ -10,4 +10,4 @@ XMLBuff *XMLBuffNew(void) {
 void XMLBuffFree(XMLBuff *in) {
 	free(in->data);
 	free(in);
-}
+}

+ 1 - 1
zip.c

@@ -67,4 +67,4 @@ int process(char const *infile, char *outfile) {
 		processDOCX(infile, outfile);
 	}
 	return 1;
-}
+}