Skip to content

Commit 94dcbd4

Browse files
committed
Clang format GNU minus includes sort
1 parent b7d2309 commit 94dcbd4

File tree

308 files changed

+75153
-70990
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+75153
-70990
lines changed

src/java/nxt_jni.c

Lines changed: 94 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -11,165 +11,164 @@
1111

1212
#include "nxt_jni.h"
1313

14+
static jclass nxt_java_NoSuchElementException_class;
15+
static jclass nxt_java_IOException_class;
16+
static jclass nxt_java_IllegalStateException_class;
17+
static jclass nxt_java_File_class;
18+
static jmethodID nxt_java_File_ctor;
1419

15-
static jclass nxt_java_NoSuchElementException_class;
16-
static jclass nxt_java_IOException_class;
17-
static jclass nxt_java_IllegalStateException_class;
18-
static jclass nxt_java_File_class;
19-
static jmethodID nxt_java_File_ctor;
20-
21-
static inline char nxt_java_lowcase(char c);
22-
20+
static inline char nxt_java_lowcase (char c);
2321

2422
int
25-
nxt_java_jni_init(JNIEnv *env)
23+
nxt_java_jni_init (JNIEnv *env)
2624
{
27-
jclass cls;
25+
jclass cls;
2826

29-
cls = (*env)->FindClass(env, "java/util/NoSuchElementException");
30-
if (cls == NULL) {
31-
return NXT_UNIT_ERROR;
27+
cls = (*env)->FindClass (env, "java/util/NoSuchElementException");
28+
if (cls == NULL)
29+
{
30+
return NXT_UNIT_ERROR;
3231
}
3332

34-
nxt_java_NoSuchElementException_class = (*env)->NewGlobalRef(env, cls);
35-
(*env)->DeleteLocalRef(env, cls);
33+
nxt_java_NoSuchElementException_class = (*env)->NewGlobalRef (env, cls);
34+
(*env)->DeleteLocalRef (env, cls);
3635

37-
38-
cls = (*env)->FindClass(env, "java/io/IOException");
39-
if (cls == NULL) {
40-
(*env)->DeleteGlobalRef(env, nxt_java_NoSuchElementException_class);
41-
return NXT_UNIT_ERROR;
36+
cls = (*env)->FindClass (env, "java/io/IOException");
37+
if (cls == NULL)
38+
{
39+
(*env)->DeleteGlobalRef (env, nxt_java_NoSuchElementException_class);
40+
return NXT_UNIT_ERROR;
4241
}
4342

44-
nxt_java_IOException_class = (*env)->NewGlobalRef(env, cls);
45-
(*env)->DeleteLocalRef(env, cls);
46-
43+
nxt_java_IOException_class = (*env)->NewGlobalRef (env, cls);
44+
(*env)->DeleteLocalRef (env, cls);
4745

48-
cls = (*env)->FindClass(env, "java/lang/IllegalStateException");
49-
if (cls == NULL) {
50-
(*env)->DeleteGlobalRef(env, nxt_java_NoSuchElementException_class);
51-
(*env)->DeleteGlobalRef(env, nxt_java_IOException_class);
52-
return NXT_UNIT_ERROR;
46+
cls = (*env)->FindClass (env, "java/lang/IllegalStateException");
47+
if (cls == NULL)
48+
{
49+
(*env)->DeleteGlobalRef (env, nxt_java_NoSuchElementException_class);
50+
(*env)->DeleteGlobalRef (env, nxt_java_IOException_class);
51+
return NXT_UNIT_ERROR;
5352
}
5453

55-
nxt_java_IllegalStateException_class = (*env)->NewGlobalRef(env, cls);
56-
(*env)->DeleteLocalRef(env, cls);
54+
nxt_java_IllegalStateException_class = (*env)->NewGlobalRef (env, cls);
55+
(*env)->DeleteLocalRef (env, cls);
5756

58-
59-
cls = (*env)->FindClass(env, "java/io/File");
60-
if (cls == NULL) {
61-
(*env)->DeleteGlobalRef(env, nxt_java_NoSuchElementException_class);
62-
(*env)->DeleteGlobalRef(env, nxt_java_IOException_class);
63-
(*env)->DeleteGlobalRef(env, nxt_java_IllegalStateException_class);
64-
return NXT_UNIT_ERROR;
57+
cls = (*env)->FindClass (env, "java/io/File");
58+
if (cls == NULL)
59+
{
60+
(*env)->DeleteGlobalRef (env, nxt_java_NoSuchElementException_class);
61+
(*env)->DeleteGlobalRef (env, nxt_java_IOException_class);
62+
(*env)->DeleteGlobalRef (env, nxt_java_IllegalStateException_class);
63+
return NXT_UNIT_ERROR;
6564
}
6665

67-
nxt_java_File_class = (*env)->NewGlobalRef(env, cls);
68-
(*env)->DeleteLocalRef(env, cls);
69-
70-
71-
nxt_java_File_ctor = (*env)->GetMethodID(env, nxt_java_File_class, "<init>",
72-
"(Ljava/lang/String;)V");
73-
if (nxt_java_File_ctor == NULL) {
74-
(*env)->DeleteGlobalRef(env, nxt_java_NoSuchElementException_class);
75-
(*env)->DeleteGlobalRef(env, nxt_java_IOException_class);
76-
(*env)->DeleteGlobalRef(env, nxt_java_IllegalStateException_class);
77-
(*env)->DeleteGlobalRef(env, nxt_java_File_class);
78-
return NXT_UNIT_ERROR;
66+
nxt_java_File_class = (*env)->NewGlobalRef (env, cls);
67+
(*env)->DeleteLocalRef (env, cls);
68+
69+
nxt_java_File_ctor = (*env)->GetMethodID (env, nxt_java_File_class, "<init>",
70+
"(Ljava/lang/String;)V");
71+
if (nxt_java_File_ctor == NULL)
72+
{
73+
(*env)->DeleteGlobalRef (env, nxt_java_NoSuchElementException_class);
74+
(*env)->DeleteGlobalRef (env, nxt_java_IOException_class);
75+
(*env)->DeleteGlobalRef (env, nxt_java_IllegalStateException_class);
76+
(*env)->DeleteGlobalRef (env, nxt_java_File_class);
77+
return NXT_UNIT_ERROR;
7978
}
8079

81-
return NXT_UNIT_OK;
80+
return NXT_UNIT_OK;
8281
}
8382

84-
8583
void
86-
nxt_java_throw_NoSuchElementException(JNIEnv *env, const char *msg)
84+
nxt_java_throw_NoSuchElementException (JNIEnv *env, const char *msg)
8785
{
88-
(*env)->ThrowNew(env, nxt_java_NoSuchElementException_class, msg);
86+
(*env)->ThrowNew (env, nxt_java_NoSuchElementException_class, msg);
8987
}
9088

91-
9289
void
93-
nxt_java_throw_IOException(JNIEnv *env, const char *msg)
90+
nxt_java_throw_IOException (JNIEnv *env, const char *msg)
9491
{
95-
(*env)->ThrowNew(env, nxt_java_IOException_class, msg);
92+
(*env)->ThrowNew (env, nxt_java_IOException_class, msg);
9693
}
9794

98-
9995
void
100-
nxt_java_throw_IllegalStateException(JNIEnv *env, const char *msg)
96+
nxt_java_throw_IllegalStateException (JNIEnv *env, const char *msg)
10197
{
102-
(*env)->ThrowNew(env, nxt_java_IllegalStateException_class, msg);
98+
(*env)->ThrowNew (env, nxt_java_IllegalStateException_class, msg);
10399
}
104100

105-
106101
nxt_unit_field_t *
107-
nxt_java_findHeader(nxt_unit_field_t *f, nxt_unit_field_t *end,
108-
const char *name, uint8_t name_len)
102+
nxt_java_findHeader (nxt_unit_field_t *f, nxt_unit_field_t *end,
103+
const char *name, uint8_t name_len)
109104
{
110-
const char *field_name;
105+
const char *field_name;
111106

112-
for (/* void */ ; f < end; f++) {
113-
if (f->skip != 0 || f->name_length != name_len) {
114-
continue;
107+
for (/* void */; f < end; f++)
108+
{
109+
if (f->skip != 0 || f->name_length != name_len)
110+
{
111+
continue;
115112
}
116113

117-
field_name = nxt_unit_sptr_get(&f->name);
114+
field_name = nxt_unit_sptr_get (&f->name);
118115

119-
if (nxt_java_strcaseeq(name, field_name, name_len)) {
120-
return f;
116+
if (nxt_java_strcaseeq (name, field_name, name_len))
117+
{
118+
return f;
121119
}
122120
}
123121

124-
return NULL;
122+
return NULL;
125123
}
126124

127-
128125
int
129-
nxt_java_strcaseeq(const char *str1, const char *str2, int len)
126+
nxt_java_strcaseeq (const char *str1, const char *str2, int len)
130127
{
131-
char c1, c2;
132-
const char *end1;
128+
char c1, c2;
129+
const char *end1;
133130

134-
end1 = str1 + len;
131+
end1 = str1 + len;
135132

136-
while (str1 < end1) {
137-
c1 = nxt_java_lowcase(*str1++);
138-
c2 = nxt_java_lowcase(*str2++);
133+
while (str1 < end1)
134+
{
135+
c1 = nxt_java_lowcase (*str1++);
136+
c2 = nxt_java_lowcase (*str2++);
139137

140-
if (c1 != c2) {
141-
return 0;
138+
if (c1 != c2)
139+
{
140+
return 0;
142141
}
143142
}
144143

145-
return 1;
144+
return 1;
146145
}
147146

148-
149147
static inline char
150-
nxt_java_lowcase(char c)
148+
nxt_java_lowcase (char c)
151149
{
152-
return (c >= 'A' && c <= 'Z') ? c | 0x20 : c;
150+
return (c >= 'A' && c <= 'Z') ? c | 0x20 : c;
153151
}
154152

155-
156153
jstring
157-
nxt_java_newString(JNIEnv *env, char *str, uint32_t len)
154+
nxt_java_newString (JNIEnv *env, char *str, uint32_t len)
158155
{
159-
char tmp;
160-
jstring res;
156+
char tmp;
157+
jstring res;
161158

162-
tmp = str[len];
159+
tmp = str[len];
163160

164-
if (tmp != '\0') {
165-
str[len] = '\0';
161+
if (tmp != '\0')
162+
{
163+
str[len] = '\0';
166164
}
167165

168-
res = (*env)->NewStringUTF(env, str);
166+
res = (*env)->NewStringUTF (env, str);
169167

170-
if (tmp != '\0') {
171-
str[len] = tmp;
168+
if (tmp != '\0')
169+
{
170+
str[len] = tmp;
172171
}
173172

174-
return res;
173+
return res;
175174
}

src/java/nxt_jni.h

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,48 @@
66
#ifndef _NXT_JAVA_JNI_H_INCLUDED_
77
#define _NXT_JAVA_JNI_H_INCLUDED_
88

9-
109
#include <jni.h>
1110
#include <nxt_unit_typedefs.h>
1211

12+
int nxt_java_jni_init (JNIEnv *env);
1313

14-
int nxt_java_jni_init(JNIEnv *env);
15-
16-
void nxt_java_throw_NoSuchElementException(JNIEnv *env, const char *msg);
17-
18-
void nxt_java_throw_IOException(JNIEnv *env, const char *msg);
14+
void nxt_java_throw_NoSuchElementException (JNIEnv *env, const char *msg);
1915

20-
void nxt_java_throw_IllegalStateException(JNIEnv *env, const char *msg);
16+
void nxt_java_throw_IOException (JNIEnv *env, const char *msg);
2117

22-
nxt_unit_field_t *nxt_java_findHeader(nxt_unit_field_t *f, nxt_unit_field_t *e,
23-
const char *name, uint8_t name_len);
18+
void nxt_java_throw_IllegalStateException (JNIEnv *env, const char *msg);
2419

25-
int nxt_java_strcaseeq(const char *str1, const char *str2, int len);
20+
nxt_unit_field_t *nxt_java_findHeader (nxt_unit_field_t *f,
21+
nxt_unit_field_t *e, const char *name,
22+
uint8_t name_len);
2623

27-
jstring nxt_java_newString(JNIEnv *env, char *str, uint32_t len);
24+
int nxt_java_strcaseeq (const char *str1, const char *str2, int len);
2825

26+
jstring nxt_java_newString (JNIEnv *env, char *str, uint32_t len);
2927

30-
typedef struct {
31-
uint32_t header_size;
32-
uint32_t buf_size;
28+
typedef struct
29+
{
30+
uint32_t header_size;
31+
uint32_t buf_size;
3332

34-
jobject jreq;
35-
jobject jresp;
33+
jobject jreq;
34+
jobject jresp;
3635

37-
nxt_unit_buf_t *first;
38-
nxt_unit_buf_t *buf;
36+
nxt_unit_buf_t *first;
37+
nxt_unit_buf_t *buf;
3938

4039
} nxt_java_request_data_t;
4140

42-
4341
static inline jlong
44-
nxt_ptr2jlong(void *ptr)
42+
nxt_ptr2jlong (void *ptr)
4543
{
46-
return (jlong) (intptr_t) ptr;
44+
return (jlong)(intptr_t)ptr;
4745
}
4846

4947
static inline void *
50-
nxt_jlong2ptr(jlong l)
48+
nxt_jlong2ptr (jlong l)
5149
{
52-
return (void *) (intptr_t) l;
50+
return (void *)(intptr_t)l;
5351
}
5452

55-
#endif /* _NXT_JAVA_JNI_H_INCLUDED_ */
53+
#endif /* _NXT_JAVA_JNI_H_INCLUDED_ */

0 commit comments

Comments
 (0)