curly braces style

Curly braces should start on a new line, after a method declaration, but
should continue on the same line after a control structure.
This commit is contained in:
Benedikt Heine 2017-11-25 01:39:54 +01:00
parent bd8fd8b1d2
commit 5b2a6e57b7
5 changed files with 24 additions and 19 deletions

View File

@ -43,8 +43,7 @@ static int regex_init(void)
void regex_teardown(void)
{
if (is_initialized)
{
if (is_initialized) {
regfree(&cregex);
is_initialized = false;
}
@ -94,7 +93,8 @@ char *extract_urls(const char *to_match)
* Open url in browser.
*
*/
void open_browser(const char *in) {
void open_browser(const char *in)
{
// remove prefix and test url
char *url = extract_urls(in);
if (!url)

View File

@ -248,7 +248,8 @@ void notification_replace_single_field(char **haystack,
g_free(input);
}
char *notification_extract_markup_urls(char **str_ptr) {
char *notification_extract_markup_urls(char **str_ptr)
{
char *start, *end, *replace_buf, *str, *urls = NULL, *url, *index_buf;
int linkno = 1;
@ -342,12 +343,12 @@ void notification_init(notification *n)
/* replace all formatter */
for(char *substr = strchr(n->msg, '%');
substr;
substr = strchr(substr, '%')){
substr = strchr(substr, '%')) {
char pg[16];
char *icon_tmp;
switch(substr[1]){
switch(substr[1]) {
case 'a':
notification_replace_single_field(
&n->msg,
@ -553,7 +554,8 @@ void notification_update_text_to_render(notification *n)
* invoke it. If there are multiple and no default, open the context menu. If
* there are no actions, proceed similarly with urls.
*/
void notification_do_action(notification *n) {
void notification_do_action(notification *n)
{
if (n->actions) {
if (n->actions->count == 2) {
action_invoked(n, n->actions->actions[0]);

View File

@ -8,7 +8,8 @@
#include <stdlib.h>
#include <string.h>
char *string_replace_char(char needle, char replacement, char *haystack) {
char *string_replace_char(char needle, char replacement, char *haystack)
{
char *current = haystack;
while ((current = strchr(current, needle)) != NULL)
*current++ = replacement;
@ -109,7 +110,8 @@ void string_strip_delimited(char *str, char a, char b)
str[iwrite] = 0;
}
char *string_to_path(char *string) {
char *string_to_path(char *string)
{
if (string && 0 == strncmp(string, "~/", 2)) {
char *home = g_strconcat(getenv("HOME"), "/", NULL);
@ -122,7 +124,8 @@ char *string_to_path(char *string) {
return string;
}
gint64 string_to_time(const char *string) {
gint64 string_to_time(const char *string)
{
assert(string);
@ -133,16 +136,13 @@ gint64 string_to_time(const char *string) {
if (errno != 0) {
fprintf(stderr, "ERROR: Time: '%s': %s.\n", string, strerror(errno));
return 0;
}
else if (string == endptr) {
} else if (string == endptr) {
fprintf(stderr, "ERROR: Time: No digits found.\n");
return 0;
}
else if (errno != 0 && val == 0) {
} else if (errno != 0 && val == 0) {
fprintf(stderr, "ERROR: Time: '%s' unknown error.\n", string);
return 0;
}
else if (errno == 0 && !*endptr) {
} else if (errno == 0 && !*endptr) {
return val * G_USEC_PER_SEC;
}

View File

@ -64,7 +64,8 @@ static double get_xft_dpi_value()
return dpi;
}
void init_screens() {
void init_screens()
{
if (!settings.force_xinerama) {
randr_init();
randr_update();

View File

@ -188,7 +188,8 @@ static bool have_dynamic_width(void)
return (xctx.geometry.mask & WidthValue && xctx.geometry.w == 0);
}
static bool does_file_exist(const char *filename){
static bool does_file_exist(const char *filename)
{
return (access(filename, F_OK) != -1);
}
@ -197,7 +198,8 @@ static bool is_readable_file(const char *filename)
return (access(filename, R_OK) != -1);
}
const char *get_filename_ext(const char *filename) {
const char *get_filename_ext(const char *filename)
{
const char *dot = strrchr(filename, '.');
if (!dot || dot == filename) return "";
return dot + 1;