-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
Replace use of iostream-based classes #246
Conversation
ToDo: Desc Signed-off-by: Mobin "Hojjat" Aydinfar <[email protected]>
Signed-off-by: Mobin "Hojjat" Aydinfar <[email protected]>
@@ -88,21 +88,21 @@ int main(int argc, char **argv) | |||
service_dir_opts.set_specified_service_dir(argv[i]); | |||
} | |||
else { | |||
cerr << "dinitcheck: '--services-dir' (-d) requires an argument" << endl; |
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.
We need to have "endl"?
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.
The endl
there looks superfluous. It might be needed elsewhere, if the buffer needs to be flushed.
private: | ||
|
||
cpbuffer<BUF_SIZE> buf; // Main buffer | ||
bool stdio_sync = false; // Make sure message writed into dest |
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.
syncing with stdio is disabled by default, Is it fine?
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.
is this supposed to be the equivalent of ios_base::sync_with_stdio
? The comment doesn't match that. What do you mean by "sync with stdio"?
Please make your own judgement and we can discuss if necessary when the PR is complete. You did ask to take on this issue so it is your responsibility! If there are questions you really can't resolve, you can ask them in the issue so we have a reasonable record of the decisions there. I would prefer not to have draft PRs - they are distracting (for me, due to all the notifications) and not a good way to discuss technical details. If you need to show some example of code in a discussion, you can link to one of your own branches for example. I'm going to unsubscribe from this PR, you will need to notify me when it is ready. |
I will create a new PR when it mostly done |
Fixes #240
Hi.
We already discussed about some technical points about this new implementation in #240 and here's its PR
My plan
My plan has 4 sections:
low-level header:
dinit-iostream.h
ostream is a low-level library and will be used for writing into file descriptors, This class provide a buffer for each output stream (4K buffer size yet) and provide
print()
function for writing into fds.print()
andprinterr()
are designed to replacecout
andcerr
. Here's basic usage of them:same as ostream but for reading from file descriptors. ToDo
high-level header:
dinit-fstream.h
ofstream is a high-level library and will be used for writing into files, This class open a file and create a ostream object and will provide some functions such as
open()
. ToDosame as ofstream but for reading from files. ToDo
Also dinitcheck modified to use these new header(s) for catching any regression. I hope it'll be on right track. Regards
Signed-off-by: Mobin "Hojjat" Aydinfar <[email protected]>