Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal][Yoga] Fixed lint errors

```arc lint --apply-patches --take CLANGFORMAT --paths-cmd 'hg files xplat/yoga'
```
Added .clang-tidy file

Reviewed By: zertosh

Differential Revision: D19948702

fbshipit-source-id: f77a16d6f2c532267597a84a9caded0aae68c3aa
  • Loading branch information
SidharthGuglani-zz authored and facebook-github-bot committed Feb 18, 2020
1 parent 96f19a3 commit d8ff5a5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
5 changes: 5 additions & 0 deletions ReactAndroid/src/main/jni/first-party/yogajni/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
Checks: '>
clang-diagnostic-*,
'
...
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ class ScopedGlobalRef {
return *this;
}

~ScopedGlobalRef() {
reset();
}
~ScopedGlobalRef() { reset(); }

/**
* Deletes the currently held reference and reassigns a new one to the
Expand Down Expand Up @@ -120,9 +118,7 @@ class ScopedGlobalRef {
/**
* Returns true if the underlying JNI reference is not NULL.
*/
operator bool() const {
return mGlobalRef != NULL;
}
operator bool() const { return mGlobalRef != NULL; }

ScopedGlobalRef(const ScopedGlobalRef& ref) = delete;
ScopedGlobalRef& operator=(const ScopedGlobalRef& other) = delete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ class ScopedLocalRef {
return *this;
}

~ScopedLocalRef() {
reset();
}
~ScopedLocalRef() { reset(); }

/**
* Deletes the currently held reference and reassigns a new one to the
Expand Down Expand Up @@ -119,9 +117,7 @@ class ScopedLocalRef {
/**
* Returns true if the underlying JNI reference is not NULL.
*/
operator bool() const {
return mLocalRef != NULL;
}
operator bool() const { return mLocalRef != NULL; }

ScopedLocalRef(const ScopedLocalRef& ref) = delete;
ScopedLocalRef& operator=(const ScopedLocalRef& other) = delete;
Expand Down
7 changes: 5 additions & 2 deletions ReactAndroid/src/main/jni/first-party/yogajni/jni/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(void, Void) {
assertNoPendingJniException(env);
}

ScopedLocalRef<jobject>
callStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodId, ...) {
ScopedLocalRef<jobject> callStaticObjectMethod(
JNIEnv* env,
jclass clazz,
jmethodID methodId,
...) {
va_list args;
va_start(args, methodId);
jobject result = env->CallStaticObjectMethodV(clazz, methodId, args);
Expand Down
7 changes: 5 additions & 2 deletions ReactAndroid/src/main/jni/first-party/yogajni/jni/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(void, Void);
DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jlong, Long);
DEFINE_CALL_METHOD_FOR_PRIMITIVE_INTERFACE(jfloat, Float);

ScopedLocalRef<jobject>
callStaticObjectMethod(JNIEnv* env, jclass clazz, jmethodID methodId, ...);
ScopedLocalRef<jobject> callStaticObjectMethod(
JNIEnv* env,
jclass clazz,
jmethodID methodId,
...);

/**
* Given a local or a global reference, this method creates a new global
Expand Down

0 comments on commit d8ff5a5

Please sign in to comment.