[PR #1185] [MERGED] [IMPROVEMENT] Improve and simplify dprintf implementation #1974

Open
opened 2026-01-29 17:19:33 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1185
Author: @NilsIrl
Created: 1/15/2020
Status: Merged
Merged: 1/25/2020
Merged by: @cfsmp3

Base: masterHead: dprintf_impl


📝 Commits (1)

  • 477dc1a Improve and simplify dprintf implementation

📊 Changes

2 files changed (+15 additions, -37 deletions)

View changed files

📝 src/lib_ccx/ccx_common_common.c (+14 -36)
📝 src/lib_ccx/ccx_common_common.h (+1 -1)

📄 Description

In raising this pull request, I confirm the following (please check boxes):

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • I have considered, and confirmed that this submission will be valuable to others.
  • I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  • I give this submission freely, and claim no ownership to its content.

My familiarity with the project is as follows (check one):

  • I have used CCExtractor just a couple of times.

It now returns a value like the rest of the printf family. It doesn't
brute force the amount of memory that needs to be allocated.

It also removes a warning.

0a1
> Scanning dependencies of target ccx
60,63d60
< /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c: In function ‘fdprintf’:
< /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:27:4: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
<    27 |    write(fd, p, n);
<       |    ^~~~~~~~~~~~~~~
69c66
<     inlined from ‘add_cc_sub_text’ at /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:95:3:
---
>     inlined from ‘add_cc_sub_text’ at /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:73:3:

I do not believe there should be any performance concerns with this
implementation as it is what glibc does (if anything it probably improves performance by a lot):

https://code.woboq.org/userspace/glibc/libio/iovdprintf.c.html


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1185 **Author:** [@NilsIrl](https://github.com/NilsIrl) **Created:** 1/15/2020 **Status:** ✅ Merged **Merged:** 1/25/2020 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `dprintf_impl` --- ### 📝 Commits (1) - [`477dc1a`](https://github.com/CCExtractor/ccextractor/commit/477dc1af9179a846d7e3d25b8451f25321b33521) Improve and simplify dprintf implementation ### 📊 Changes **2 files changed** (+15 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `src/lib_ccx/ccx_common_common.c` (+14 -36) 📝 `src/lib_ccx/ccx_common_common.h` (+1 -1) </details> ### 📄 Description **In raising this pull request, I confirm the following (please check boxes):** - [X] I have read and understood the [contributors guide](https://github.com/CCExtractor/ccextractor/blob/master/.github/CONTRIBUTING.md). - [X] I have checked that another pull request for this purpose does not exist. - [X] I have considered, and confirmed that this submission will be valuable to others. - [X] I accept that this submission may not be used, and the pull request closed at the will of the maintainer. - [X] I give this submission freely, and claim no ownership to its content. **My familiarity with the project is as follows (check one):** - [X] I have used CCExtractor just a couple of times. --- It now returns a value like the rest of the printf family. It doesn't brute force the amount of memory that needs to be allocated. It also removes a warning. ```patch 0a1 > Scanning dependencies of target ccx 60,63d60 < /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c: In function ‘fdprintf’: < /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:27:4: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] < 27 | write(fd, p, n); < | ^~~~~~~~~~~~~~~ 69c66 < inlined from ‘add_cc_sub_text’ at /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:95:3: --- > inlined from ‘add_cc_sub_text’ at /home/nils/Documents/codein2019/ccextractor/src/lib_ccx/ccx_common_common.c:73:3: ``` I do not believe there should be any performance concerns with this implementation as it is what `glibc` does (if anything it probably improves performance by a lot): https://code.woboq.org/userspace/glibc/libio/iovdprintf.c.html --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:19:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#1974