mirror of
https://github.com/shadow-maint/shadow.git
synced 2026-01-29 15:24:12 +00:00
sizeof(foo) - No spaces. Not: sizeof (foo) - Parentheses. Not: sizeof foo - No parentheses wrapping sizeof itself Not: (sizeof foo) This patch can be approximated with the following semantic patch: $ cat ~/tmp/spatch/sizeof.sp @@ identifier a, b; @@ - sizeof a->b + sizeof(a->b) @@ identifier a, b; @@ - sizeof a.b + sizeof(a.b) @@ identifier x; @@ - sizeof x + sizeof(x) @@ identifier x; @@ - sizeof *x + sizeof(*x) @@ identifier x; @@ - (sizeof(x)) + sizeof(x) @@ identifier x; @@ - (sizeof(*x)) + sizeof(*x) Applied as $ find contrib/ lib* src/ -type f \ | xargs spatch --sp-file ~/tmp/spatch/sizeof.sp --in-place; The differences between the actual patch and the approximation via the semantic patch from above are whitespace only. When reviewing, it'll be useful to diff with '-w'. Link: <https://lkml.org/lkml/2012/7/11/103> Signed-off-by: Alejandro Colomar <alx@kernel.org>
57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 1991 - 1994, Julianne Frances Haugh
|
|
* SPDX-FileCopyrightText: 1991 - 1994, Chip Rosenthal
|
|
* SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
|
|
* SPDX-FileCopyrightText: 2003 - 2005, Tomasz Kłoczko
|
|
* SPDX-FileCopyrightText: 2007 - 2010, Nicolas François
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include "config.h"
|
|
|
|
#ifndef USE_PAM
|
|
|
|
#ident "$Id$"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "defines.h"
|
|
#include "getdef.h"
|
|
#include "prototypes.h"
|
|
#include "string/strtok/stpsep.h"
|
|
|
|
|
|
/*
|
|
* tz - return local timezone name
|
|
*
|
|
* tz() determines the name of the local timezone by reading the
|
|
* contents of the file named by ``fname''.
|
|
*/
|
|
/*@observer@*/const char *tz (const char *fname)
|
|
{
|
|
FILE *fp = NULL;
|
|
const char *result;
|
|
static char tzbuf[BUFSIZ];
|
|
|
|
fp = fopen (fname, "r");
|
|
if ( (NULL == fp)
|
|
|| (fgets(tzbuf, sizeof(tzbuf), fp) == NULL)) {
|
|
result = "TZ=CST6CDT";
|
|
} else {
|
|
stpsep(tzbuf, "\n");
|
|
result = tzbuf;
|
|
}
|
|
|
|
if (NULL != fp) {
|
|
(void) fclose (fp);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
#else /* !USE_PAM */
|
|
extern int ISO_C_forbids_an_empty_translation_unit;
|
|
#endif /* !USE_PAM */
|
|
|