{"id":13667615,"url":"https://github.com/awslabs/aws-c-common","last_synced_at":"2026-02-19T13:33:42.373Z","repository":{"id":39132606,"uuid":"117142517","full_name":"awslabs/aws-c-common","owner":"awslabs","description":"Core c99 package for AWS SDK for C. Includes cross-platform primitives, configuration, data structures, and error handling.","archived":false,"fork":false,"pushed_at":"2026-01-21T18:58:03.000Z","size":4640,"stargazers_count":295,"open_issues_count":24,"forks_count":170,"subscribers_count":33,"default_branch":"main","last_synced_at":"2026-01-26T20:08:08.927Z","etag":null,"topics":["aws-sdk","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awslabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-01-11T19:17:12.000Z","updated_at":"2026-01-23T08:28:55.000Z","dependencies_parsed_at":"2022-07-13T19:10:26.100Z","dependency_job_id":"458d7125-91f2-4712-9481-1b6231999443","html_url":"https://github.com/awslabs/aws-c-common","commit_stats":{"total_commits":896,"total_committers":84,"mean_commits":"10.666666666666666","dds":0.8895089285714286,"last_synced_commit":"06cf4d82adad52723305dc2aeb06bb6439b5df7f"},"previous_names":[],"tags_count":203,"template":false,"template_full_name":null,"purl":"pkg:github/awslabs/aws-c-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-c-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-c-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-c-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-c-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awslabs","download_url":"https://codeload.github.com/awslabs/aws-c-common/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awslabs%2Faws-c-common/sbom","scorecard":{"id":219539,"data":{"date":"2025-08-11","repo":{"name":"github.com/awslabs/aws-c-common","commit":"cde20c682d46ed8ee03ab6412c3f386f5dbdd0c7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":6.8,"checks":[{"name":"Code-Review","score":9,"reason":"Found 29/30 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":6,"reason":"8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":8,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: required approving review count is 1 on branch 'main'","Warn: codeowners review is required - but no codeowners file found in repo","Info: status check found to merge onto on branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/awslabs/.github/SECURITY.md:1","Info: Found linked content: github.com/awslabs/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/awslabs/.github/SECURITY.md:1","Info: Found text in security policy: github.com/awslabs/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/proof_ci.yaml:28","Info: jobLevel 'pull-requests' permission set to 'read': .github/workflows/proof_ci.yaml:30","Warn: no topLevel permission defined: .github/workflows/clang-format.yml:1","Warn: no topLevel permission defined: .github/workflows/clang-tidy.yml:1","Warn: no topLevel permission defined: .github/workflows/closed-issue-message.yml:1","Warn: no topLevel permission defined: .github/workflows/handle-stale-discussions.yml:1","Warn: no topLevel permission defined: .github/workflows/issue-regression-labeler.yml:1","Warn: no topLevel permission defined: .github/workflows/proof_ci.yaml:1","Warn: no topLevel permission defined: .github/workflows/stale_issue.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: AWSCRTAndroidTestRunner/gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: CLibFuzzer integration found: tests/fuzz/base64_encoding_transitive.c:9","Info: CLibFuzzer integration found: tests/fuzz/cbor_decoding_transitive.c:10","Info: CLibFuzzer integration found: tests/fuzz/cbor_double_encode_decode.c:10","Info: CLibFuzzer integration found: tests/fuzz/hex_encoding_transitive.c:9"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Info: Possibly incomplete results: error parsing shell code: \"for foo [in words]\" must be followed by \"do\": verification/cbmc/proofs/build-buildspec.sh:0","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:241: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:254: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:258: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:260: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:312: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:175: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:299: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:324: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:336: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:82: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:228: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:274: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:278: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:282: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:97: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:121: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:148: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:215: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:109: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:133: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:163: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:187: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:199: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/clang-format.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/clang-format.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/clang-tidy.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/clang-tidy.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/closed-issue-message.yml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/closed-issue-message.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codecov.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/codecov.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/codecov.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/handle-stale-discussions.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/handle-stale-discussions.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/issue-regression-labeler.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/issue-regression-labeler.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/proof_ci.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/proof_ci.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/proof_ci.yaml:180: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/proof_ci.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/stale_issue.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/awslabs/aws-c-common/stale_issue.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/proof_ci.yaml:85","Warn: pipCommand not pinned by hash: .github/workflows/proof_ci.yaml:93","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  27 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":1,"reason":"SAST tool is not run on all commits -- score normalized to 1","details":["Warn: 5 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T02:12:57.601Z","repository_id":39132606,"created_at":"2025-08-17T02:12:57.601Z","updated_at":"2025-08-17T02:12:57.601Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29614969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T13:04:20.082Z","status":"ssl_error","status_checked_at":"2026-02-19T13:03:33.775Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-sdk","hacktoberfest"],"created_at":"2024-08-02T07:00:44.081Z","updated_at":"2026-02-19T13:33:42.354Z","avatar_url":"https://github.com/awslabs.png","language":"C","funding_links":[],"categories":["AWS Python SDKs","C"],"sub_categories":[],"readme":"## AWS C Common\n\n\n[![GitHub](https://img.shields.io/github/license/awslabs/aws-c-common.svg)](https://github.com/awslabs/aws-c-common/blob/main/LICENSE)\n\nCore c99 package for AWS SDK for C. Includes cross-platform primitives, configuration, data structures, and error handling.\n\n## License\n\nThis library is licensed under the Apache 2.0 License.\n\n## Usage\n### Building\naws-c-common uses CMake for setting up build environments. This library has no non-kernel dependencies so the build is quite\nsimple.\n\nFor example:\n\n    git clone git@github.com:awslabs/aws-c-common.git aws-c-common\n    mkdir aws-c-common-build\n    cd aws-c-common-build\n    cmake ../aws-c-common\n    make -j 12\n    make test\n    sudo make install\n\nKeep in mind that CMake supports multiple build systems, so for each platform you can pass your own build system\nas the `-G` option. For example:\n\n    cmake -GNinja ../aws-c-common\n    ninja build\n    ninja test\n    sudo ninja install\n\nOr on windows,\n\n    cmake -G \"Visual Studio 14 2015 Win64\" ../aws-c-common\n    msbuild.exe ALL_BUILD.vcproj\n\n### CMake Options\n* -DCMAKE_CLANG_TIDY=/path/to/clang-tidy (or just clang-tidy or clang-tidy-7.0 if it is in your PATH) - Runs clang-tidy as part of your build.\n* -DENABLE_SANITIZERS=ON - Enables gcc/clang sanitizers, by default this adds -fsanitizer=address,undefined to the compile flags for projects that call aws_add_sanitizers.\n* -DENABLE_FUZZ_TESTS=ON - Includes fuzz tests in the unit test suite. Off by default, because fuzz tests can take a long time. Set -DFUZZ_TESTS_MAX_TIME=N to determine how long to run each fuzz test (default 60s).\n* -DCMAKE_INSTALL_PREFIX=/path/to/install - Standard way of installing to a user defined path. If specified when configuring aws-c-common, ensure the same prefix is specified when configuring other aws-c-* SDKs.\n* -DAWS_STATIC_MSVC_RUNTIME_LIBRARY=ON - Windows-only. Turn ON to use the statically-linked MSVC runtime lib, instead of the DLL.\n\n### API style and conventions\nEvery API has a specific set of styles and conventions. We'll outline them here. These conventions are followed in every\nlibrary in the AWS C SDK ecosystem.\n\n#### Error handling\nEvery function that returns an `int` type, returns `AWS_OP_SUCCESS` ( 0 ) or `AWS_OP_ERR` (-1) on failure. To retrieve\nthe error code, use the function `aws_last_error()`. Each error code also has a corresponding error string that can be\naccessed via the `aws_error_str()` function.\n\nIn addition, you can install both a global and a thread local error handler by using the `aws_set_global_error_handler_fn()`\nand `aws_set_thread_local_error_handler_fn()` functions.\n\nAll error functions are in the `include/aws/common/error.h` header file.\n\n#### Naming\nAny function that allocates and initializes an object will be suffixed with `new` (e.g. `aws_myobj_new()`). Similarly, these objects will always\nhave a corresponding function with a `destroy` suffix. The `new` functions will return the allocated object\non success and `NULL` on failure. To respond to the error, call `aws_last_error()`. If several `new` or `destroy`\nfunctions are available, the variants should be named like `new_x` or `destroy_x` (e.g. `aws_myobj_new_copy()` or `aws_myobj_destroy_secure()`).\n\nAny function that initializes an existing object will be suffixed with `init` (e.g. `aws_myobj_init()`. These objects will have a corresponding\n`clean_up` function if necessary. In these cases, you are responsible for making the decisions for how your object is\nallocated. The `init` functions return `AWS_OP_SUCCESS` ( 0 ) or `AWS_OP_ERR` (-1) on failure. If several `init` or\n`clean_up` functions are available, they should be named like `init_x` or `clean_up_x` (e.g. `aws_myobj_init_static()` or\n`aws_myobj_clean_up_secure()`).\n\n## Contributing\n\nIf you are contributing to this code-base, first off, THANK YOU!. There are a few things to keep in mind to minimize the\npull request turn around time.\n\n### Coding \"guidelines\"\nThese \"guidelines\" are followed in every library in the AWS C SDK ecosystem.\n\n#### Memory Management\n* All APIs that need to be able to allocate memory, must take an instance of `aws_allocator` and use that. No `malloc()` or\n`free()` calls should be made directly.\n* If an API does not allocate the memory, it does not free it. All allocations and deallocations should take place at the same level.\nFor example, if a user allocates memory, the user is responsible for freeing it. There will inevitably be a few exceptions to this\nrule, but they will need significant justification to make it through the code-review.\n* All functions that allocate memory must raise an `AWS_ERROR_OOM` error code upon allocation failures. If it is a `new()` function\nit should return NULL. If it is an `init()` function, it should return `AWS_OP_ERR`.\n\n#### Threading\n* Occasionally a thread is necessary. In those cases, prefer for memory not to be shared between threads. If memory must cross\na thread barrier it should be a complete ownership hand-off. Bias towards, \"if I need a mutex, I'm doing it wrong\".\n* Do not sleep or block .... ever .... under any circumstances, in non-test-code.\n* Do not expose blocking APIs.\n\n### Error Handling\n* For APIs returning an `int` error code. The only acceptable return types are `AWS_OP_SUCCESS` and `AWS_OP_ERR`. Before\nreturning control to the caller, if you have an error to raise, use the `aws_raise_error()` function.\n* For APIs returning an allocated instance of an object, return the memory on success, and `NULL` on failure. Before\nreturning control to the caller, if you have an error to raise, use the `aws_raise_error()` function.\n\nSee [error-handling.md](docs/error-handling.md) for a longer tutorial.\n\n#### Log Subjects \u0026 Error Codes\nThe logging \u0026 error handling infrastructure is designed to support multiple libraries. For this to work, AWS maintained libraries\nhave pre-slotted log subjects \u0026 error codes for each library. The currently allocated ranges are:\n\n| Range | Library Name |\n| --- | --- |\n| [0x0000, 0x0400) | aws-c-common |\n| [0x0400, 0x0800) | aws-c-io |\n| [0x0800, 0x0C00) | aws-c-http |\n| [0x0C00, 0x1000) | aws-c-compression |\n| [0x1000, 0x1400) | aws-c-eventstream |\n| [0x1400, 0x1800) | aws-c-mqtt |\n| [0x1800, 0x1C00) | aws-c-auth |\n| [0x1C00, 0x2000) | aws-c-cal |\n| [0x2000, 0x2400) | aws-crt-cpp |\n| [0x2400, 0x2800) | aws-crt-java |\n| [0x2800, 0x2C00) | aws-crt-python |\n| [0x2C00, 0x3000) | aws-crt-nodejs |\n| [0x3000, 0x3400) | aws-crt-dotnet |\n| [0x3400, 0x3800) | aws-c-iot |\n| [0x3800, 0x3C00) | aws-c-s3 |\n| [0x3C00, 0x4000) | aws-c-sdkutils |\n| [0x4000, 0x4400) | aws-crt-kotlin |\n| [0x4400, 0x4800) | aws-crt-swift |\n| [0x4800, 0x4C00) | (reserved for future project) |\n\nEach library should begin its error and log subject values at the beginning of its range and follow in sequence (don't skip codes). Upon\nadding an AWS maintained library, a new enum range must be approved and added to the above table.\n\n### Testing\nWe have a high bar for test coverage, and PRs fixing bugs or introducing new functionality need to have tests before\nthey will be accepted. A couple of tips:\n\n#### Aws Test Harness\nWe provide a test harness for writing unit tests. This includes an allocator that will fail your test if you have any\nmemory leaks, as well as some `ASSERT` macros. To write a test:\n\n* Create a *.c test file in the tests directory of the project.\n* Implement one or more tests with the signature `int test_case_name(struct aws_allocator *, void *ctx)`\n* Use the `AWS_TEST_CASE` macro to declare the test.\n* Include your test in the `tests/main.c` file.\n* Include your test in the `tests/CMakeLists.txt` file.\n\n### Coding Style\n* No Tabs.\n* Indent is 4 spaces.\n* K \u0026 R style for braces.\n* Space after if, before the `(`.\n* `else` and `else if` stay on the same line as the closing brace.\n\nExample:\n\n    if (condition) {\n        do_something();\n    } else {\n        do_something_else();\n    }\n* Avoid C99 features in header files. For some types such as bool, uint32_t etc..., these are defined if not available for the language\nstandard being used in `aws/common/common.h`, so feel free to use them.\n* For C++ compatibility, don't put const members in structs.\n* Avoid C++ style comments e.g. `//` in header files and prefer block style  (`/* */`) for long blocks of text. C++ style comments are fine in C files.\n* All public API functions need C++ guards and Windows dll semantics.\n* Use Unix line endings.\n* Where implementation hiding is desired for either ABI or runtime polymorphism reasons, use the `void *impl` pattern. v-tables\n should be the last member in the struct.\n* For #ifdef, put a # as the first character on the line and then indent the compilation branches.\n\nExample:\n\n\n    #ifdef FOO\n        do_something();\n\n    #   ifdef BAR\n        do_something_else();\n    #   endif\n    #endif\n\n\n* For all error code names with the exception of aws-c-common, use `AWS_ERROR_\u003clib name\u003e_\u003cerror name\u003e`.\n* All error strings should be written using correct English grammar.\n* SNAKE_UPPER_CASE constants, macros, and enum members.\n* snake_lower_case everything else.\n* `static` (local file scope) variables that are not `const` are prefixed by `s_` and lower snake case.\n* Global variables not prefixed as `const` are prefixed by `g_` and lower snake case.\n* Thread local variables are prefixed as `tl_` and lower snake case.\n* Macros and `const` variables are upper snake case.\n* For constants, prefer anonymous enums.\n* Don't typedef structs. It breaks forward declaration ability.\n* Don't typedef enums. It breaks forward declaration ability.\n* typedef function definitions for use as function pointers as values and suffixed with _fn.\n\n    Do this:\n\n        typedef int(fn_name_fn)(void *);\n\n    Not this:\n\n        typedef int(*fn_name_fn)(void *);\n\n* If a callback may be async, then always have it be async.\n  Callbacks that are sometimes async and sometimes sync are hard to code around and lead to bugs\n  (see [this blog post](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)).\n  Unfortunately many callbacks in this codebase currently violate this rule,\n  so be careful. But do not add any more.\n* Every source and header file must have a copyright header (The standard AWS one for apache 2).\n* Use standard include guards (e.g. #IFNDEF HEADER_NAME #define HEADER_NAME etc...).\n* Include order should be:\n    the header for the translation unit for the .c file\n    newline\n    header files in a directory in alphabetical order\n    newline\n    header files not in a directory (system and stdlib headers)\n* Platform specifics should be handled in c files and partitioned by directory.\n* Do not use `extern inline`. It's too unpredictable between compiler versions and language standards.\n* Namespace all definitions in header files with `aws_\u003clibname\u003e?_\u003capi\u003e_\u003cwhat it does\u003e`. Lib name is\nnot always required if a conflict is not likely and it provides better ergonomics.\n* `init`, `clean_up`, `new`, `destroy` are suffixed to the function names for their object.\n\nExample:\n\n    AWS_COMMON_API\n int aws_module_init(aws_module_t *module);\n    AWS_COMMON_API\n void aws_module_clean_up(aws_module_t *module);\n    AWS_COMMON_API\n aws_module_t *aws_module_new(aws_allocator_t *allocator);\n    AWS_COMMON_API\n void aws_module_destroy(aws_module_t *module);\n\n* Avoid c-strings, and don't write code that depends on `NULL` terminators.\n    * Pass strings via `struct aws_byte_cursor`. This is a non-owning view type. Pass it by value. Strings passed this way do not need a `NULL` terminator.\n    * Only pass `const char *` when thinly wrapping an OS function that *requires* a `NULL` terminator.\n    * Store const strings as `struct aws_string *`\n    * Store mutable string buffers as `struct aws_byte_buf`\n\n* There is only one valid character encoding-- UTF-8. Try not to ever need to care about character encodings, but\nwhere you do, the working assumption should always be UTF-8 unless it's something we don't get a choice in (e.g. a protocol\nexplicitly mandates a character set).\n* If a function has many arguments, or any optional arguments use an options-struct.\n* If a variable is time-related, always include the unit of time in its name (e.g. `timeout_ms`).\n* If you are adding/using a compiler specific keyword, macro, or intrinsic, hide it behind a platform independent macro\ndefinition. This mainly applies to header files. Obviously, if you are writing a file that will only be built on a certain\nplatform, you have more liberty on this.\n* When checking more than one error condition, check and log each condition separately with a unique message.\n\n    Do this:\n\n        if (options-\u003ecallback == NULL) {\n            AWS_LOGF_ERROR(AWS_LS_SOME_SUBJECT, \"Invalid options - callback is null\");\n            return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);\n        }\n\n        if (options-\u003eallocator == NULL) {\n            AWS_LOGF_ERROR(AWS_LS_SOME_SUBJECT, \"Invalid options - allocator is null\");\n            return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);\n        }\n\n    Not this:\n\n        if (options-\u003ecallback == NULL || options-\u003eallocator == NULL) {\n            AWS_LOGF_ERROR(AWS_LS_SOME_SUBJECT, \"Invalid options - something is null\");\n            return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);\n        }\n\n## CBMC\n\nTo learn more about CBMC and proofs specifically, review the training material [here](https://model-checking.github.io/cbmc-training).\n\nThe `verification/cbmc/proofs` directory contains CBMC proofs.\n\nIn order to run these proofs you will need to install CBMC and other tools by following the instructions [here](https://model-checking.github.io/cbmc-training/installation.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Faws-c-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawslabs%2Faws-c-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawslabs%2Faws-c-common/lists"}