library: make that 'escape_str' private to our library

In that commit referenced below, a promise was made to
revisit an 'escape_str' function in efforts to make it
private to the library. The problem was it's needed by
both ps plus the library which is why it was exported.

So, in an effort to remove it from libprocps.sym, this
patch duplicates all the required code in ps/output.c.
Now, each version can be made private to their caller.

[ along the way we'll use this opportunity to remove ]
[ the 'restrict' qualifiers from function parameters ]
[ while swatting a compiler warning referenced below ]

Reference(s):
. April 2016, most escape functions made private
commit d916d5db86

proc/escape.c: In function `escape_command':
proc/escape.c:182:23: warning: initialization of `const char **' from incompatible pointer type `char **' [-Wincompatible-pointer-types]
  182 |     const char **lc = (char**)pp->cmdline;
      |                       ^

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2020-06-30 00:00:00 -05:00
committed by Craig Small
parent 1aa8b16441
commit 605ea4a8f7
6 changed files with 129 additions and 29 deletions

View File

@ -13,7 +13,6 @@
#define PROCPS_PS_H
#include "../include/nls.h"
#include <proc/escape.h>
#include <proc/meminfo.h>
#include <proc/pids.h>
#include <proc/stat.h>
@ -204,7 +203,6 @@ makEXT(noop)
* Try not to overflow the output buffer:
* 32 pages for env+cmd
* 64 kB pages on IA-64
* 4 chars for "\377", or 1 when mangling to '?' (ESC_STRETCH)
* plus some slack for other stuff
* That is about 8.5 MB on IA-64, or 0.6 MB on i386
*
@ -214,7 +212,7 @@ makEXT(noop)
*/
/* output buffer size */
#define OUTBUF_SIZE (2 * 64*1024 * ESC_STRETCH)
#define OUTBUF_SIZE (2 * 64*1024)
/******************* PS DEFINE *******************/