Browse Source

update:补充注释

alienwalker 1 year ago
parent
commit
f50f6b14fa
2 changed files with 9 additions and 5 deletions
  1. 3 4
      components/network/libftp/luat_lib_ftp.c
  2. 6 1
      luat/include/luat_rtc.h

+ 3 - 4
components/network/libftp/luat_lib_ftp.c

@@ -74,12 +74,11 @@ static int l_ftp_login(lua_State *L) {
 	if (lua_isboolean(L, 6)){
 		if (lua_toboolean(L, 6)){
 			luat_ftp_tls = (luat_ftp_tls_t *)luat_heap_malloc(sizeof(luat_ftp_tls_t));
+			memset(luat_ftp_tls, 0, sizeof(luat_ftp_tls_t));
 		}
 	}else if (lua_istable(L, 6)){
-		if (luat_ftp_tls == NULL){
-			luat_ftp_tls = (luat_ftp_tls_t *)luat_heap_malloc(sizeof(luat_ftp_tls_t));
-		}
-		
+		luat_ftp_tls = (luat_ftp_tls_t *)luat_heap_malloc(sizeof(luat_ftp_tls_t));
+		memset(luat_ftp_tls, 0, sizeof(luat_ftp_tls_t));
 		lua_pushstring(L, "server_cert");
 		if (LUA_TSTRING == lua_gettable(L, 6)) {
 			luat_ftp_tls->server_cert = luaL_checklstring(L, -1, &len);

+ 6 - 1
luat/include/luat_rtc.h

@@ -25,7 +25,12 @@ int luat_rtc_get(struct tm *tblock);
 int luat_rtc_timer_start(int id, struct tm *tblock);
 int luat_rtc_timer_stop(int id);
 void luat_rtc_set_tamp32(uint32_t tamp);
-
+/**
+ * @brief 设置时区,或者同步底层时区到应用层
+ *
+ * @param timezone 时区值的指针,如果是空的,则同步底层时区到应用层
+ * @return int 当前时区
+ */
 int luat_rtc_timezone(int* timezone);
 
 #endif