xpp: style - one macro cleanup
* Wrap in do {} while(0) * Move closer to its use (it's #undef'ed anyway after this section) * Also re-organize line-breaking in the same code section Signed-off-by: Oron Peled <oron.peled@xorcom.com> Acked-By: Tzafrir Cohen <tzafrir.cohen@xorcom.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10434 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
parent
f9fb9622ec
commit
0244106553
@ -245,18 +245,14 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
|
||||
seconds = seconds % 60;
|
||||
hours = minutes / 60;
|
||||
minutes = minutes % 60;
|
||||
#define SHOW(ptr,item) \
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, \
|
||||
"%-15s: %8d\n", #item, (ptr)->item)
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len,
|
||||
"%-15s: %8d (was %d:%02d:%02d ago)\n", "lost_ticks",
|
||||
di->lost_ticks, hours, minutes, seconds);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len,
|
||||
"%-15s: %8d (was %d:%02d:%02d ago)\n", "lost_ticks",
|
||||
di->lost_ticks, hours, minutes, seconds);
|
||||
speed_range = abs(di->max_speed - di->min_speed);
|
||||
uframes_inaccuracy = di->sync_inaccuracy / 125;
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d ", "instability",
|
||||
speed_range + uframes_inaccuracy);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len,
|
||||
"%-15s: %8d ", "instability",
|
||||
speed_range + uframes_inaccuracy);
|
||||
if (xbus->sync_mode == SYNC_MODE_AB) {
|
||||
buf[len++] = '-';
|
||||
} else {
|
||||
@ -266,20 +262,21 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
|
||||
buf[len++] = '#';
|
||||
}
|
||||
buf[len++] = '\n';
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d (uframes)\n",
|
||||
"inaccuracy", uframes_inaccuracy);
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n", "speed_range",
|
||||
speed_range);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d (uframes)\n",
|
||||
"inaccuracy", uframes_inaccuracy);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
|
||||
"speed_range", speed_range);
|
||||
#define SHOW(ptr, item) \
|
||||
do { \
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, \
|
||||
"%-15s: %8d\n", #item, (ptr)->item); \
|
||||
} while (0)
|
||||
SHOW(xbus, sync_adjustment);
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
|
||||
"offset (usec)", di->offset_prev);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
|
||||
"offset (usec)", di->offset_prev);
|
||||
SHOW(di, offset_range);
|
||||
len +=
|
||||
snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n", "best_speed",
|
||||
(di->max_speed + di->min_speed) / 2);
|
||||
len += snprintf(buf + len, PAGE_SIZE - len, "%-15s: %8d\n",
|
||||
"best_speed", (di->max_speed + di->min_speed) / 2);
|
||||
SHOW(di, min_speed);
|
||||
SHOW(di, max_speed);
|
||||
SHOW(ticker, cycle);
|
||||
|
Loading…
Reference in New Issue
Block a user