Exportable version of WizziLab's modem driver.

Dependents:   modem_ref_helper

Revision:
64:7c338f388d82
Parent:
63:544a488a06d3
Child:
65:c7749f9b6009
--- a/src/alp_payload.cpp	Tue Sep 21 16:33:36 2021 +0000
+++ b/src/alp_payload.cpp	Thu Sep 23 15:06:02 2021 +0000
@@ -24,28 +24,36 @@
 
 #include "WizziDebug.h"
 
+static int32_t g_payload_nb = 0;
+
 alp_payload_t* alp_payload_new(u32 size)
 {
     alp_payload_t* alp = (alp_payload_t*)MALLOC(sizeof(alp_payload_t) - 1 + size);
 
     alp->len = 0;
     alp->next = NULL;
+    
+    g_payload_nb++;
 
     return alp;
 }
 
 void alp_payload_free(alp_payload_t* alp)
-{    
-    if (NULL == alp)
+{
+    while (alp != NULL)
     {
-        return;
-    }
+        alp_payload_t* alp_next = alp->next;   
+        FREE(alp);
+        
+        g_payload_nb--;
 
-    alp_payload_t* alp_next = alp->next;
-    
-    FREE(alp);
+        alp = alp_next;
+    }
+}
 
-    alp_payload_free(alp_next);
+void alp_payload_print_nb(void)
+{
+    PRINT("ALP: %d payloads assigned\n", g_payload_nb);
 }
 
 //======================================================================