Skip to content

Commit

Permalink
Global differential attributes code review requests.
Browse files Browse the repository at this point in the history
Signed-off-by: fpagliughi <[email protected]>
  • Loading branch information
fpagliughi committed Feb 3, 2020
1 parent 17148ef commit 2abe5f7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions local.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,15 +1483,15 @@ static unsigned int is_global_attr(struct iio_channel *chn, const char *attr)
// Check for matching global differential attr, like "voltage-voltage"
dashptr = strchr(attr, '-');
if (dashptr && dashptr > attr && dashptr < ptr) {
unsigned int len1 = dashptr - attr,
len2 = ptr - dashptr - 1;
unsigned int len1 = dashptr - attr;
unsigned int len2 = ptr - dashptr - 1;
const char* iddashptr = strchr(chn->id, '-');
if (iddashptr && strlen(iddashptr+1) > len2 &&
if (iddashptr && strlen(iddashptr + 1) > len2 &&
iddashptr - chn->id > len1 &&
chn->id[len1] >= '0' && chn->id[len1] <= '9' &&
!strncmp(chn->id, attr, len1) &&
iddashptr[len2+1] >= '0' && iddashptr[len2+1] <= '9' &&
!strncmp(iddashptr+1, dashptr+1, len2))
iddashptr[len2 + 1] >= '0' && iddashptr[len2 + 1] <= '9' &&
!strncmp(iddashptr + 1, dashptr + 1, len2))
return 1;
}

Expand Down

0 comments on commit 2abe5f7

Please sign in to comment.