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:
parent
bd8fd8b1d2
commit
5b2a6e57b7
@ -43,8 +43,7 @@ static int regex_init(void)
|
|||||||
|
|
||||||
void regex_teardown(void)
|
void regex_teardown(void)
|
||||||
{
|
{
|
||||||
if (is_initialized)
|
if (is_initialized) {
|
||||||
{
|
|
||||||
regfree(&cregex);
|
regfree(&cregex);
|
||||||
is_initialized = false;
|
is_initialized = false;
|
||||||
}
|
}
|
||||||
@ -94,7 +93,8 @@ char *extract_urls(const char *to_match)
|
|||||||
* Open url in browser.
|
* Open url in browser.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void open_browser(const char *in) {
|
void open_browser(const char *in)
|
||||||
|
{
|
||||||
// remove prefix and test url
|
// remove prefix and test url
|
||||||
char *url = extract_urls(in);
|
char *url = extract_urls(in);
|
||||||
if (!url)
|
if (!url)
|
||||||
|
@ -248,7 +248,8 @@ void notification_replace_single_field(char **haystack,
|
|||||||
g_free(input);
|
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;
|
char *start, *end, *replace_buf, *str, *urls = NULL, *url, *index_buf;
|
||||||
int linkno = 1;
|
int linkno = 1;
|
||||||
|
|
||||||
@ -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
|
* invoke it. If there are multiple and no default, open the context menu. If
|
||||||
* there are no actions, proceed similarly with urls.
|
* 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) {
|
||||||
if (n->actions->count == 2) {
|
if (n->actions->count == 2) {
|
||||||
action_invoked(n, n->actions->actions[0]);
|
action_invoked(n, n->actions->actions[0]);
|
||||||
|
18
src/utils.c
18
src/utils.c
@ -8,7 +8,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.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;
|
char *current = haystack;
|
||||||
while ((current = strchr(current, needle)) != NULL)
|
while ((current = strchr(current, needle)) != NULL)
|
||||||
*current++ = replacement;
|
*current++ = replacement;
|
||||||
@ -109,7 +110,8 @@ void string_strip_delimited(char *str, char a, char b)
|
|||||||
str[iwrite] = 0;
|
str[iwrite] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *string_to_path(char *string) {
|
char *string_to_path(char *string)
|
||||||
|
{
|
||||||
|
|
||||||
if (string && 0 == strncmp(string, "~/", 2)) {
|
if (string && 0 == strncmp(string, "~/", 2)) {
|
||||||
char *home = g_strconcat(getenv("HOME"), "/", NULL);
|
char *home = g_strconcat(getenv("HOME"), "/", NULL);
|
||||||
@ -122,7 +124,8 @@ char *string_to_path(char *string) {
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint64 string_to_time(const char *string) {
|
gint64 string_to_time(const char *string)
|
||||||
|
{
|
||||||
|
|
||||||
assert(string);
|
assert(string);
|
||||||
|
|
||||||
@ -133,16 +136,13 @@ gint64 string_to_time(const char *string) {
|
|||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
fprintf(stderr, "ERROR: Time: '%s': %s.\n", string, strerror(errno));
|
fprintf(stderr, "ERROR: Time: '%s': %s.\n", string, strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (string == endptr) {
|
||||||
else if (string == endptr) {
|
|
||||||
fprintf(stderr, "ERROR: Time: No digits found.\n");
|
fprintf(stderr, "ERROR: Time: No digits found.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (errno != 0 && val == 0) {
|
||||||
else if (errno != 0 && val == 0) {
|
|
||||||
fprintf(stderr, "ERROR: Time: '%s' unknown error.\n", string);
|
fprintf(stderr, "ERROR: Time: '%s' unknown error.\n", string);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (errno == 0 && !*endptr) {
|
||||||
else if (errno == 0 && !*endptr) {
|
|
||||||
return val * G_USEC_PER_SEC;
|
return val * G_USEC_PER_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,8 @@ static double get_xft_dpi_value()
|
|||||||
return dpi;
|
return dpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_screens() {
|
void init_screens()
|
||||||
|
{
|
||||||
if (!settings.force_xinerama) {
|
if (!settings.force_xinerama) {
|
||||||
randr_init();
|
randr_init();
|
||||||
randr_update();
|
randr_update();
|
||||||
|
@ -188,7 +188,8 @@ static bool have_dynamic_width(void)
|
|||||||
return (xctx.geometry.mask & WidthValue && xctx.geometry.w == 0);
|
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);
|
return (access(filename, F_OK) != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +198,8 @@ static bool is_readable_file(const char *filename)
|
|||||||
return (access(filename, R_OK) != -1);
|
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, '.');
|
const char *dot = strrchr(filename, '.');
|
||||||
if (!dot || dot == filename) return "";
|
if (!dot || dot == filename) return "";
|
||||||
return dot + 1;
|
return dot + 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user