浏览代码

Ajout documentation + verification

Loquicom 6 年之前
父节点
当前提交
bd4cc794d5
共有 2 个文件被更改,包括 25 次插入3 次删除
  1. 6 2
      mysh.c
  2. 19 1
      subdiv.c

+ 6 - 2
mysh.c

@@ -225,7 +225,9 @@ int main(int argc, char* argv[], char* envp[]) {
         clean_command(&ct);
     }
     //Nettoyage
-    end_ipc();
+    if(!end_ipc()){
+        adderror("Impossible de terminer correctement les IPC");
+    }
     clean_pid(&pidlist);
     error.end();
     return EXIT_SUCCESS;
@@ -423,7 +425,9 @@ void handler(int sig){
         pn = pn->next;
     }
     //Termine l'execution
-    end_ipc();
+    if(!end_ipc()){
+        adderror("Impossible de terminer correctement les IPC");
+    }
     clean_pid(&pidlist);
     error.exit();
 }

+ 19 - 1
subdiv.c

@@ -4,7 +4,13 @@
 #include "subdiv.h" 
 
 /* --- Fonctions privées traitement valeurs --- */
-
+/**
+ * Indique si une chaine est la clef d'un noeud
+ * @param node* Le noeud
+ * @param char* La mémoire
+ * @param char* La clef
+ * @return true - Oui/false - Non
+ */
 boolean is_key(node* n, char* mem, char* key) {
     int i, length = strlen(key);
     //Verif que la clef correspond à celle en param
@@ -20,6 +26,13 @@ boolean is_key(node* n, char* mem, char* key) {
     return true;
 }
 
+/**
+ * Cherche une clef
+ * @param subdiv* Le gestionnaire de mémoire par subdivision
+ * @param char* La mémoire
+ * @param char* La clef
+ * @return La node correspondante ou NULL si introuvable
+ */
 node* find_key(subdiv* sd, char* mem, char* key) {
     int length = strlen(key) + 2; //Clef + = + taille min mot
     node* n = NULL;
@@ -36,6 +49,11 @@ node* find_key(subdiv* sd, char* mem, char* key) {
     return n;
 }
 
+/**
+ * Récupère la valeur d'un noeid
+ * @param node* La noeud
+ * @param char* La mémoire
+ */
 char* parse_val(node* n, char* mem) {
     int pos = 0;
     //Cherche la postion du =