Skip to content

Run clang-format on existing sources #1080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2020
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jan 8, 2020

As per the suggestion in #1071 (comment), this PR fixes pre-existing code style errors that were missed in previous PRs.

Note: a few changes in PHP 5 compatible code had to be excluded manually. Since this code will be dropped after the next release anyways, I didn't investigate any further.

@jmikola
Copy link
Member

jmikola commented Jan 8, 2020

Running clang-format myself on the project, I get the following diff:

diff --git a/src/MongoDB/Exception/CommandException.c b/src/MongoDB/Exception/CommandException.c
index 7e148c87..e73ed041 100644
--- a/src/MongoDB/Exception/CommandException.c
+++ b/src/MongoDB/Exception/CommandException.c
@@ -41,7 +41,7 @@ static PHP_METHOD(CommandException, getResultDocument)
 #if PHP_VERSION_ID >= 70000
        resultdocument = zend_read_property(php_phongo_commandexception_ce, getThis(), ZEND_STRL("resultDocument"), 0, &rv TSRMLS_CC);
 #else
-       resultdocument = zend_read_property(php_phongo_commandexception_ce, getThis(), ZEND_STRL("resultDocument"), 0 TSRMLS_CC);
+       resultdocument                 = zend_read_property(php_phongo_commandexception_ce, getThis(), ZEND_STRL("resultDocument"), 0 TSRMLS_CC);
 #endif
 
        RETURN_ZVAL(resultdocument, 1, 0);
diff --git a/src/MongoDB/Exception/RuntimeException.c b/src/MongoDB/Exception/RuntimeException.c
index cec91d51..0125752d 100644
--- a/src/MongoDB/Exception/RuntimeException.c
+++ b/src/MongoDB/Exception/RuntimeException.c
@@ -89,7 +89,7 @@ static PHP_METHOD(RuntimeException, hasErrorLabel)
 #if PHP_VERSION_ID >= 70000
        error_labels = zend_read_property(php_phongo_runtimeexception_ce, getThis(), ZEND_STRL("errorLabels"), 0, &rv TSRMLS_CC);
 #else
-       error_labels = zend_read_property(php_phongo_runtimeexception_ce, getThis(), ZEND_STRL("errorLabels"), 0 TSRMLS_CC);
+       error_labels                   = zend_read_property(php_phongo_runtimeexception_ce, getThis(), ZEND_STRL("errorLabels"), 0 TSRMLS_CC);
 #endif
 
        RETURN_BOOL(php_phongo_has_string_array_element(error_labels, label TSRMLS_CC));
diff --git a/src/bson.c b/src/bson.c
index 3b6d31d4..3e24191e 100644
--- a/src/bson.c
+++ b/src/bson.c
@@ -1567,17 +1567,17 @@ bool php_phongo_bson_state_parse_fieldpaths(zval* typemap, php_phongo_bson_typem
 #else
        {
                HashPosition pos;
-               zval**       property;
+               zval** property;
 
                for (
                        zend_hash_internal_pointer_reset_ex(ht_data, &pos);
                        zend_hash_get_current_data_ex(ht_data, (void**) &property, &pos) == SUCCESS;
                        zend_hash_move_forward_ex(ht_data, &pos)) {
 
-                       char*                         string_key     = NULL;
-                       uint                          string_key_len = 0;
-                       ulong                         num_key        = 0;
-                       zend_class_entry*             map_ce         = NULL;
+                       char* string_key = NULL;
+                       uint string_key_len = 0;
+                       ulong num_key = 0;
+                       zend_class_entry* map_ce = NULL;
                        php_phongo_bson_typemap_types map_type;
 
                        if (HASH_KEY_IS_STRING != zend_hash_get_current_key_ex(ht_data, &string_key, &string_key_len, &num_key, 0, &pos)) {

Are these the PHP 5.x bits that you excluded? If so, LGTM.

@alcaeus
Copy link
Member Author

alcaeus commented Jan 8, 2020

@jmikola: affirmative. Not sure why it’s messing up the indentation there, but should be easy enough to ignore until we drop that code.

alcaeus added a commit that referenced this pull request Jan 9, 2020
@alcaeus alcaeus merged commit 94bb265 into mongodb:master Jan 9, 2020
@alcaeus alcaeus deleted the clang-format branch January 9, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants