mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-02-05 17:28:23 +08:00
free when pop int and float
This commit is contained in:
parent
dcddd8bbb5
commit
64111e1063
2
port/linux/.vscode/launch.json
vendored
2
port/linux/.vscode/launch.json
vendored
@ -13,7 +13,7 @@
|
|||||||
"args": [
|
"args": [
|
||||||
// "--gtest_filter=object_test.test2"
|
// "--gtest_filter=object_test.test2"
|
||||||
// "--gtest_filter=block.init"
|
// "--gtest_filter=block.init"
|
||||||
"--gtest_filter=block.ifrun2"
|
// "--gtest_filter=block.ifrun2"
|
||||||
// "--gtest_filter=sysObj.print"
|
// "--gtest_filter=sysObj.print"
|
||||||
// "--gtest_filter=object_test.a_b"
|
// "--gtest_filter=object_test.a_b"
|
||||||
// "--gtest_filter=object_test.voidRun"
|
// "--gtest_filter=object_test.voidRun"
|
||||||
|
@ -27,7 +27,7 @@ int32_t queue_pushInt(Queue* queue, int val) {
|
|||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t top = args_getInt(args, "top");
|
uint64_t top = args_getInt(args, "top");
|
||||||
char topStr[32] = {0};
|
char topStr[32] = {0};
|
||||||
sprintf(topStr, "%d", top);
|
sprintf(topStr, "%ld", top);
|
||||||
/* add top */
|
/* add top */
|
||||||
args_setInt(args, "top", top + 1);
|
args_setInt(args, "top", top + 1);
|
||||||
return args_setInt(args, topStr, val);
|
return args_setInt(args, topStr, val);
|
||||||
@ -37,17 +37,19 @@ int64_t queue_popInt(Queue* queue) {
|
|||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t bottom = args_getInt(args, "bottom");
|
uint64_t bottom = args_getInt(args, "bottom");
|
||||||
char bottomStr[32] = {0};
|
char bottomStr[32] = {0};
|
||||||
sprintf(bottomStr, "%d", bottom);
|
sprintf(bottomStr, "%ld", bottom);
|
||||||
/* add bottom */
|
/* add bottom */
|
||||||
args_setInt(args, "bottom", bottom + 1);
|
args_setInt(args, "bottom", bottom + 1);
|
||||||
return args_getInt(args, bottomStr);
|
int64_t res = args_getInt(args, bottomStr);
|
||||||
|
args_removeArg(args, bottomStr);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t queue_pushFloat(Queue* queue, float val) {
|
int32_t queue_pushFloat(Queue* queue, float val) {
|
||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t top = args_getInt(args, "top");
|
uint64_t top = args_getInt(args, "top");
|
||||||
char topStr[32] = {0};
|
char topStr[32] = {0};
|
||||||
sprintf(topStr, "%d", top);
|
sprintf(topStr, "%ld", top);
|
||||||
/* add top */
|
/* add top */
|
||||||
args_setInt(args, "top", top + 1);
|
args_setInt(args, "top", top + 1);
|
||||||
return args_setFloat(args, topStr, val);
|
return args_setFloat(args, topStr, val);
|
||||||
@ -57,17 +59,19 @@ float queue_popFloat(Queue* queue) {
|
|||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t bottom = args_getInt(args, "bottom");
|
uint64_t bottom = args_getInt(args, "bottom");
|
||||||
char bottomStr[32] = {0};
|
char bottomStr[32] = {0};
|
||||||
sprintf(bottomStr, "%d", bottom);
|
sprintf(bottomStr, "%ld", bottom);
|
||||||
/* add bottom */
|
/* add bottom */
|
||||||
args_setInt(args, "bottom", bottom + 1);
|
args_setInt(args, "bottom", bottom + 1);
|
||||||
return args_getFloat(args, bottomStr);
|
float res = args_getFloat(args, bottomStr);
|
||||||
|
args_removeArg(args, bottomStr);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t queue_pushStr(Queue* queue, char* str) {
|
int32_t queue_pushStr(Queue* queue, char* str) {
|
||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t top = args_getInt(args, "top");
|
uint64_t top = args_getInt(args, "top");
|
||||||
char topStr[32] = {0};
|
char topStr[32] = {0};
|
||||||
sprintf(topStr, "%d", top);
|
sprintf(topStr, "%ld", top);
|
||||||
/* add top */
|
/* add top */
|
||||||
args_setInt(args, "top", top + 1);
|
args_setInt(args, "top", top + 1);
|
||||||
return args_setStr(args, topStr, str);
|
return args_setStr(args, topStr, str);
|
||||||
@ -77,7 +81,7 @@ char* queue_popStr(Queue* queue) {
|
|||||||
Args* args = queue;
|
Args* args = queue;
|
||||||
uint64_t bottom = args_getInt(args, "bottom");
|
uint64_t bottom = args_getInt(args, "bottom");
|
||||||
char bottomStr[32] = {0};
|
char bottomStr[32] = {0};
|
||||||
sprintf(bottomStr, "%d", bottom);
|
sprintf(bottomStr, "%ld", bottom);
|
||||||
/* add bottom */
|
/* add bottom */
|
||||||
args_setInt(args, "bottom", bottom + 1);
|
args_setInt(args, "bottom", bottom + 1);
|
||||||
return args_getStr(args, bottomStr);
|
return args_getStr(args, bottomStr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user