* [PATCH] docs: fix two "maybe be" duplications in program comments
@ 2015-01-18 20:50 Benno Schulenberg
2015-01-18 21:17 ` JWP
2015-01-26 10:29 ` Karel Zak
0 siblings, 2 replies; 3+ messages in thread
From: Benno Schulenberg @ 2015-01-18 20:50 UTC (permalink / raw)
To: util-linux
Also improve the grammar of the comments and some neighbours.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
---
lib/path.c | 7 ++-----
libsmartcols/src/table_print.c | 30 ++++++++++++++----------------
2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/lib/path.c b/lib/path.c
index 42d321c..316af47 100644
--- a/lib/path.c
+++ b/lib/path.c
@@ -1,9 +1,6 @@
/*
- * Simple functions to access files, paths maybe be globally prefixed by a
- * global prefix to read data from alternative destination (e.g. /proc dump for
- * regression tests).
- *
- * Taken from lscpu.c
+ * Simple functions to access files. Paths can be globally prefixed to read
+ * data from an alternative source (e.g. a /proc dump for regression tests).
*
* Copyright (C) 2008 Cai Qian <qcai@redhat.com>
* Copyright (C) 2008-2012 Karel Zak <kzak@redhat.com>
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index 647692c..f08560c 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -219,10 +219,10 @@ static void print_empty_cell(struct libscols_table *tb,
fputc(' ', tb->out);
}
-/* fill-in all line with padding (or tree asci-art)
+/* Fill the start of a line with padding (or with tree ascii-art).
*
- * This is necessary after long non-truncated colum where next column
- * is printed in next line. For example (see 'DDD'):
+ * This is necessary after a long non-truncated column, as this requires the
+ * next column to be printed on the next line. For example (see 'DDD'):
*
* aaa bbb ccc ddd eee
* AAA BBB CCCCCCC
@@ -401,8 +401,8 @@ static int cell_to_buffer(struct libscols_table *tb,
}
/*
- * Prints data, data maybe be printed in more formats (raw, NAME=xxx pairs) and
- * control and non-printable chars maybe encoded in \x?? hex encoding.
+ * Prints data. Data can be printed in more formats (raw, NAME=xxx pairs), and
+ * control and non-printable characters can be encoded in the \x?? encoding.
*/
static int print_line(struct libscols_table *tb,
struct libscols_line *ln,
@@ -445,8 +445,7 @@ static int print_header(struct libscols_table *tb, struct libscols_buffer *buf)
DBG(TAB, ul_debugobj(tb, "printing header"));
- /* set width according to the size of data
- */
+ /* set the width according to the size of the data */
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (rc == 0 && scols_table_next_column(tb, &itr, &cl) == 0) {
rc = buffer_set_data(buf, scols_cell_get_data(&cl->header));
@@ -551,11 +550,11 @@ static void dbg_columns(struct libscols_table *tb)
/*
* This function counts column width.
*
- * For the SCOLS_FL_NOEXTREMES columns is possible to call this function two
- * times. The first pass counts width and average width. If the column
- * contains too large fields (width greater than 2 * average) then the column
- * is marked as "extreme". In the second pass all extreme fields are ignored
- * and column width is counted from non-extreme fields only.
+ * For the SCOLS_FL_NOEXTREMES columns it is possible to call this function
+ * two times. The first pass counts the width and average width. If the column
+ * contains fields that are too large (a width greater than 2 * average) then
+ * the column is marked as "extreme". In the second pass all extreme fields
+ * are ignored and the column width is counted from non-extreme fields only.
*/
static int count_column_width(struct libscols_table *tb,
struct libscols_column *cl,
@@ -653,8 +652,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
if (!tb->is_term)
return 0;
- /* reduce columns with extreme fields
- */
+ /* reduce columns with extreme fields */
if (width > tb->termwidth && extremes) {
DBG(TAB, ul_debugobj(tb, " reduce width (extreme columns)"));
@@ -710,7 +708,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
if (width < tb->termwidth && scols_table_is_maxout(tb)) {
DBG(TAB, ul_debugobj(tb, " enlarge width (max-out)"));
- /* try enlarge all columns */
+ /* try enlarging all columns */
while (width < tb->termwidth) {
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (scols_table_next_column(tb, &itr, &cl) == 0) {
@@ -735,7 +733,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
}
/* bad, we have to reduce output width, this is done in two steps:
- * 1/ reduce columns with a relative width and with truncate flag
+ * 1) reduce columns with a relative width and with truncate flag
* 2) reduce columns with a relative width without truncate flag
*/
trunc_only = 1;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] docs: fix two "maybe be" duplications in program comments
2015-01-18 20:50 [PATCH] docs: fix two "maybe be" duplications in program comments Benno Schulenberg
@ 2015-01-18 21:17 ` JWP
2015-01-26 10:29 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: JWP @ 2015-01-18 21:17 UTC (permalink / raw)
To: Benno Schulenberg, util-linux
On 01/18/2015 03:50 PM, Benno Schulenberg wrote:
> if (!tb->is_term)
> return 0;
>
> - /* reduce columns with extreme fields
> - */
> + /* reduce columns with extreme fields */
> if (width > tb->termwidth && extremes) {
> DBG(TAB, ul_debugobj(tb, " reduce width (extreme columns)"));
>
This is a common practice to add some delimiting space between a
comment and the code; just as the the empty line above it does.
> @@ -710,7 +708,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
> if (width < tb->termwidth && scols_table_is_maxout(tb)) {
> DBG(TAB, ul_debugobj(tb, " enlarge width (max-out)"));
>
> - /* try enlarge all columns */
> + /* try enlarging all columns */
> while (width < tb->termwidth) {
> scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
> while (scols_table_next_column(tb, &itr, &cl) == 0) {
> @@ -735,7 +733,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
> }
>
> /* bad, we have to reduce output width, this is done in two steps:
> - * 1/ reduce columns with a relative width and with truncate flag
> + * 1) reduce columns with a relative width and with truncate flag
> * 2) reduce columns with a relative width without truncate flag
> */
> trunc_only = 1;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] docs: fix two "maybe be" duplications in program comments
2015-01-18 20:50 [PATCH] docs: fix two "maybe be" duplications in program comments Benno Schulenberg
2015-01-18 21:17 ` JWP
@ 2015-01-26 10:29 ` Karel Zak
1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2015-01-26 10:29 UTC (permalink / raw)
To: Benno Schulenberg; +Cc: util-linux
On Sun, Jan 18, 2015 at 09:50:27PM +0100, Benno Schulenberg wrote:
> lib/path.c | 7 ++-----
> libsmartcols/src/table_print.c | 30 ++++++++++++++----------------
> 2 files changed, 16 insertions(+), 21 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-26 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-18 20:50 [PATCH] docs: fix two "maybe be" duplications in program comments Benno Schulenberg
2015-01-18 21:17 ` JWP
2015-01-26 10:29 ` Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.