[HUST CSE]Fixed an error where parameters could not be assigned …#22
Merged
BernardXiong merged 4 commits intoRT-Thread:mainfrom May 1, 2023
fly1ngpengu1ns:main
Merged
[HUST CSE]Fixed an error where parameters could not be assigned …#22BernardXiong merged 4 commits intoRT-Thread:mainfrom fly1ngpengu1ns:main
BernardXiong merged 4 commits intoRT-Thread:mainfrom
fly1ngpengu1ns:main
Conversation
…correctly due to incorrect form of parameters passed in
Member
|
这个不会这么修改的,因为需要保证代码风格的一致性。这样的后果只能靠人工方式来检查代码了,避免在webclient_close后依然在使用指针。 |
added 3 commits
April 26, 2023 12:52
…correctly due to incorrect form of parameters passed in
Author
您说的非常有道理,之前的修改方式会破坏代码的一致性。不过我注意到在:https://github.com/RT-Thread/userapps/blob/main/apps/webclient/packages/webclient-v2.1.2/src/webclient.c#L1695 这里, |
Member
BernardXiong
approved these changes
May 1, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

在函数
webclient_close中,传入的是session的指针,同时此函数的作用是释放其指向的空间。但是问题在于传入的是指针而非指针的指针,因此在函数结束时的session = RT_NULL;语句将无法改变外部值。而在多数调用此函数的时候,并没有顺手将seesion赋值成RT_NULL,因此在此修改了函数
webclient_close的传入参数形式,变成传入指针的指针来达到目标。值得注意的是,还有一种修改方法是在每次调用时手动赋值为RT_NULL,不过这样似乎略显繁琐,您觉得那种方法更好呢?