Skip to content

Commit

Permalink
seperate config_fopen wrapper (goatshriek#310)
Browse files Browse the repository at this point in the history
Continuing the elimination of include/private/config/wrapper.h
by moving another function into its own wrapper header.

Also adds a gitignore rule for DS_Store files so that they are not
inadvertently added in the future.

This fixes goatshriek#298, which can be referenced for more details.
  • Loading branch information
iltenahmet authored Dec 12, 2022
1 parent 25b3bc5 commit c1adb39
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ docs/html/*
.vs/*
.vscode/*
CMakeSettings.json

**/.DS_Store

# Ignore files generated by CMake
build/*
Expand Down
11 changes: 0 additions & 11 deletions include/private/config/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
# define __STUMPLESS_PRIVATE_CONFIG_WRAPPER_H

# include <stumpless/config.h>
# include "private/config.h"


/* definition of config_open_default_target */
# ifdef STUMPLESS_WINDOWS_EVENT_LOG_TARGETS_SUPPORTED
Expand All @@ -41,13 +39,4 @@
# define config_close_default_target stumpless_close_file_target
# endif


/* definition of config_fopen */
# ifdef HAVE_FOPEN_S
# include "private/config/have_fopen_s.h"
# define config_fopen fopen_s_fopen
# else
# include <stdio.h>
# define config_fopen fopen
# endif
#endif /* __STUMPLESS_PRIVATE_CONFIG_WRAPPER_H */
33 changes: 33 additions & 0 deletions include/private/config/wrapper/fopen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* SPDX-License-Identifier: Apache-2.0 */

/*
* Copyright 2022 Joel E. Anderson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __STUMPLESS_PRIVATE_CONFIG_WRAPPER_FOPEN_H
# define __STUMPLESS_PRIVATE_CONFIG_WRAPPER_FOPEN_H

# include "private/config.h"

/* definition of config_fopen */
# ifdef HAVE_FOPEN_S
# include "private/config/have_fopen_s.h"
# define config_fopen fopen_s_fopen
# else
# include <stdio.h>
# define config_fopen fopen
# endif

#endif /* __STUMPLESS_PRIVATE_CONFIG_WRAPPER_FOPEN_H */
2 changes: 1 addition & 1 deletion src/target/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#include <stumpless/target/file.h>
#include "private/config/locale/wrapper.h"
#include "private/config/wrapper/thread_safety.h"
#include "private/config/wrapper.h"
#include "private/error.h"
#include "private/inthelper.h"
#include "private/memory.h"
#include "private/target.h"
#include "private/target/file.h"
#include "private/validate.h"
#include "private/config/wrapper/fopen.h"

void
stumpless_close_file_target( struct stumpless_target *target ) {
Expand Down
1 change: 1 addition & 0 deletions tools/check_headers/stumpless_private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"config_copy_wstring_to_cstring": "private/config/wrapper/wstring.h"
"config_destroy_cached_mutex": "private/config/wrapper/thread_safety.h"
"config_destroy_mutex": "private/config/wrapper/thread_safety.h"
"config_fopen": "private/config/wrapper/fopen.h"
"config_getpid": "private/config/wrapper/getpid.h"
"config_format_string": "private/config/wrapper/format_string.h"
"config_get_local_socket_name": "private/config/wrapper/socket.h"
Expand Down

0 comments on commit c1adb39

Please sign in to comment.