Hi Zhenhua,
---
gatchat/gatserver.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index bbaef52..6e3347c 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -227,10 +227,48 @@ static gboolean is_extended_character(const char c)
}
}
static GAtServerResult at_command_notify(GAtServer *server, char *command,
char *prefix)
{
GAtServerResult res = G_AT_SERVER_RESULT_ERROR;
+ struct at_command *node;
+
+ node = g_hash_table_lookup(server->command_list, prefix);
+ if (node && node->notify) {
+ GAtServerRequestType type;
+ GAtResult result;
+
+ type = get_command_type(command, prefix);
+ if (type == G_AT_SERVER_REQUEST_TYPE_ERROR)
+ return res;
+
+ result.lines = g_slist_prepend(NULL, command);
+ result.final_or_pdu = 0;
+
+ res = node->notify(type, &result, node->user_data);
+ }
Are you freeing the slist anywhere? In general you might want to run valgrind
before submitting patches just to make sure there are no visible leaks.
Regards,
-Denis