-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config file for pools #461
Conversation
# Conflicts: # client/Makefile # client/xdag_config.c # client/xdag_config.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thnak you for your great efforts! Could you please write short manual how to set config file?
char *line = NULL; | ||
int line_len = 0, buf_len = 0; | ||
|
||
while(!feof(fp)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You read line from file. Do the lines really can be so long, so you need to read them in several iterations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I am worried that there may be an expansion later.
Delete 4 empty lines combine variable declaration and usage len-2+1 Maybe just len-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see some memory leaks where you use strdup
All strdup is free when xdag_config_close closed |
saw now, great |
your parser seems good! |
Thank you for your suggestion, ok, I will modify it. |
{ | ||
return TYPE_KEY; | ||
} | ||
return TYPE_UNKNOW; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you print the line in xdag_err TYPE_UNKNOW case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you print the line in xdag_err TYPE_UNKNOW case?
ok
client/xdag_config.c
Outdated
|
||
|
||
char * get_pool_config(const char *path){ | ||
static char result[80]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why static?
|
||
char * get_pool_config(const char *path){ | ||
static char result[80]; | ||
if(path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't use strcat? strncat(result, str,strlen(str)) makes no sense
and i see that you doesn't check the buffer overflow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrote this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems good, we can fix the style later
Just two questions:
|
1.No default path for config file,but there is a sample file in "/xdag/client/example.ini". The xdag startup command is as follows: |
Ok, thank you for you great efforts. |
#329 Config file for pools