Skip to content
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

Utilize blockwise I/O in ModelicaInternal_copyFile #3229

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

beutlich
Copy link
Member

Blockwise I/O usually is faster then byte-wise I/O.

@beutlich beutlich added enhancement New feature or enhancement L: C-Sources Issue addresses Modelica/Resources/C-Sources labels Nov 13, 2019
@beutlich beutlich added this to the MSL4.0.0 milestone Nov 13, 2019
@beutlich beutlich self-assigned this Nov 13, 2019
Copy link
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good general idea, but:

  • Always use "rb" and "wb". They are C-standard and supposed to work the same on Linux.
  • It is unclear where BUFSIZ comes from.
  • Is it intentional to ignore read-errors? Since the previous version ignored all errors that may be ok

@beutlich
Copy link
Member Author

beutlich commented Nov 14, 2019

Always use "rb" and "wb". They are C-standard and supposed to work the same on Linux.

Yes, that is actually how I edited the code.

It is unclear where BUFSIZ comes from.

It is defined in the C standard library, in header stdio.h.

Is it intentional to ignore read-errors? Since the previous version ignored all errors that may be ok

How can read errors be detected? len==0 or len<BUFSIZ are completely valid read results.

@beutlich beutlich requested review from HansOlsson and sjoelund and removed request for sjoelund November 27, 2019 21:36
@HansOlsson
Copy link
Contributor

How can read errors be detected? len==0 or len<BUFSIZ are completely valid read results.

Well, one can use ferror() - but it is a bit messy and adds extra code.

Copy link
Contributor

@HansOlsson HansOlsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
The extra check for read-errors can be added later.

@beutlich beutlich merged commit 8972a6b into modelica:master Dec 6, 2019
@beutlich beutlich deleted the update-copy branch December 6, 2019 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement L: C-Sources Issue addresses Modelica/Resources/C-Sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants