Skip to content

Commit 669bf2c

Browse files
authored
Use __EMSCRIPTEN__ instead of EMSCRIPTEN to wrap wasm-specific code (#200)
1 parent 29ba827 commit 669bf2c

17 files changed

Lines changed: 34 additions & 34 deletions

‎src/utils/config_overrides.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "config_overrides.hpp"
22

3-
#ifdef EMSCRIPTEN
3+
#ifdef __EMSCRIPTEN__
44
# include <iterator>
55

66
# include <git2/sys/config.h>
@@ -10,7 +10,7 @@
1010

1111
void apply_config_overrides([[maybe_unused]] git_repository* repo)
1212
{
13-
#ifdef EMSCRIPTEN
13+
#ifdef __EMSCRIPTEN__
1414
// Config values to override, each in "name=value" form. core.filemode is disabled because
1515
// the emscripten filesystem does support executable file permissions but some JupyterLite
1616
// drive implementations do not.

‎src/wasm/libgit2_internals.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef EMSCRIPTEN
1+
#ifdef __EMSCRIPTEN__
22

33
# include "libgit2_internals.hpp"
44

@@ -63,4 +63,4 @@ std::optional<http_service> select_service(git_smart_service_t action)
6363
return std::nullopt;
6464
}
6565

66-
#endif // EMSCRIPTEN
66+
#endif // __EMSCRIPTEN__

‎src/wasm/libgit2_internals.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#ifdef EMSCRIPTEN
3+
#ifdef __EMSCRIPTEN__
44

55
# include <optional>
66
# include <string>
@@ -63,4 +63,4 @@ std::string name_for_method(git_http_method method);
6363

6464
std::optional<http_service> select_service(git_smart_service_t action);
6565

66-
#endif // EMSCRIPTEN
66+
#endif // __EMSCRIPTEN__

‎src/wasm/read_buffer.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef EMSCRIPTEN
1+
#ifdef __EMSCRIPTEN__
22

33
# include "read_buffer.hpp"
44

@@ -9,4 +9,4 @@ read_buffer_t::read_buffer_t(char* buffer, size_t buffer_size, size_t* bytes_rea
99
{
1010
}
1111

12-
#endif // EMSCRIPTEN
12+
#endif // __EMSCRIPTEN__

‎src/wasm/read_buffer.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#ifdef EMSCRIPTEN
3+
#ifdef __EMSCRIPTEN__
44

55
# include <stddef.h>
66

@@ -15,4 +15,4 @@ struct read_buffer_t
1515
size_t* m_bytes_read;
1616
};
1717

18-
#endif // EMSCRIPTEN
18+
#endif // __EMSCRIPTEN__

‎src/wasm/response.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef EMSCRIPTEN
1+
#ifdef __EMSCRIPTEN__
22

33
# include "response.hpp"
44

@@ -82,4 +82,4 @@ void wasm_http_response::set_git_error(std::string_view url) const
8282
);
8383
}
8484

85-
#endif // EMSCRIPTEN
85+
#endif // __EMSCRIPTEN__

‎src/wasm/response.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#ifdef EMSCRIPTEN
3+
#ifdef __EMSCRIPTEN__
44

55
# include <map>
66
# include <optional>
@@ -40,4 +40,4 @@ class wasm_http_response
4040
std::multimap<const std::string, const std::string> m_response_headers;
4141
};
4242

43-
#endif // EMSCRIPTEN
43+
#endif // __EMSCRIPTEN__

‎src/wasm/scope.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#include "scope.hpp"
22

3-
#ifdef EMSCRIPTEN
3+
#ifdef __EMSCRIPTEN__
44
# include "transport.hpp"
55
#endif
66

77
wasm_http_transport_scope::wasm_http_transport_scope()
88
{
9-
#ifdef EMSCRIPTEN
9+
#ifdef __EMSCRIPTEN__
1010
git_transport_register("http", create_wasm_http_transport, nullptr);
1111
git_transport_register("https", create_wasm_http_transport, nullptr);
1212
#endif
1313
}
1414

1515
wasm_http_transport_scope::~wasm_http_transport_scope()
1616
{
17-
#ifdef EMSCRIPTEN
17+
#ifdef __EMSCRIPTEN__
1818
git_transport_unregister("http");
1919
git_transport_unregister("https");
2020
#endif

‎src/wasm/scope.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "../utils/common.hpp"
44

55
// Scope object to enable/disable browser-based wasm http transport scheme for libgit2.
6-
// This is a no-op unless EMSCRIPTEN is defined.
6+
// This is a no-op unless __EMSCRIPTEN__ is defined.
77
class wasm_http_transport_scope : noncopyable_nonmovable
88
{
99
public:

‎src/wasm/stream.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef EMSCRIPTEN
1+
#ifdef __EMSCRIPTEN__
22

33
# include "stream.hpp"
44

@@ -654,4 +654,4 @@ int wasm_http_stream_write(git_smart_subtransport_stream* s, const char* buffer,
654654
return write(stream, buffer, buffer_size);
655655
}
656656

657-
#endif // EMSCRIPTEN
657+
#endif // __EMSCRIPTEN__

0 commit comments

Comments
 (0)