pespin has uploaded this change for review.

View Change

cosmetic: osmo_io: Rename variable s/hdr/msghdr/

We use "msghdr" almost everywhere to refer to a struct iofd_msghdr, use
it in iofd_msghdr_alloc(). This allows differentiating it from its own
"struct msghdr hdr" subfield.

Change-Id: Ie00defc144dbd8cd87029d701cc4fa2943c4452b
---
M src/core/osmo_io.c
1 file changed, 11 insertions(+), 11 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/44139/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index f14f03b..83f3c05 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -142,16 +142,16 @@
struct iofd_msghdr *iofd_msghdr_alloc(struct osmo_io_fd *iofd, enum iofd_msg_action action, struct msgb *msg,
size_t cmsg_size)
{
- struct iofd_msghdr *hdr;
+ struct iofd_msghdr *msghdr;
uint8_t idx, io_len;


- hdr = talloc_zero_size(iofd, sizeof(struct iofd_msghdr) + cmsg_size);
- if (!hdr)
+ msghdr = talloc_zero_size(iofd, sizeof(struct iofd_msghdr) + cmsg_size);
+ if (!msghdr)
return NULL;

- hdr->action = action;
- hdr->iofd = iofd;
+ msghdr->action = action;
+ msghdr->iofd = iofd;

/* Allocate the number of read buffers, configured by the user. Use msg as first buffer, if not NULL.
* Only READ may have multiple buffers, because packets will only be written to the first buffer. */
@@ -159,23 +159,23 @@
for (idx = 0; idx < io_len; idx++) {
if (msg) {
talloc_steal(iofd, msg);
- hdr->msg[idx] = msg;
+ msghdr->msg[idx] = msg;
msg = NULL;
} else {
- hdr->msg[idx] = iofd_msgb_alloc(iofd);
- if (!hdr->msg[idx])
+ msghdr->msg[idx] = iofd_msgb_alloc(iofd);
+ if (!msghdr->msg[idx])
break;
}
}
/* If at least one msgb is allocated, we can continue with only one msgb, instead of completely failing. */
if (idx == 0) {
- talloc_free(hdr);
+ talloc_free(msghdr);
return NULL;
}

- hdr->io_len = idx;
+ msghdr->io_len = idx;

- return hdr;
+ return msghdr;
}

/*! Free the msghdr.

To view, visit change 44139. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie00defc144dbd8cd87029d701cc4fa2943c4452b
Gerrit-Change-Number: 44139
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>