Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# SPDX-FileCopyrightText: 2025 RAprogramm <andrey.rozanov.vl@gmail.com>
# SPDX-License-Identifier: MIT

name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 0 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [rust]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-extended

- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
4 changes: 2 additions & 2 deletions examples/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! - Simulating a C function that takes char** argv
//! - Real-world usage pattern

use std::ffi::{c_char, c_int, CStr};
use std::ffi::{CStr, c_char, c_int};

use cstring_array::CStringArray;

Expand Down Expand Up @@ -57,7 +57,7 @@ fn main() {
s if s.starts_with("--") => println!(" Option: {}", s),
s if s.starts_with('-') => println!(" Flag: {}", s),
s if i == 0 => println!(" Program: {}", s),
s => println!(" Argument: {}", s),
s => println!(" Argument: {}", s)
}
}
}
5 changes: 4 additions & 1 deletion examples/zero_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ fn main() {
println!(" Created {} CStrings", large_cstrings.len());
let large_array = CStringArray::from_cstrings(large_cstrings).expect("Failed to create array");
println!(" Zero-copy array length: {}", large_array.len());
println!(" First element: {}", large_array.get(0).unwrap().to_str().unwrap());
println!(
" First element: {}",
large_array.get(0).unwrap().to_str().unwrap()
);
println!(
" Last element: {}",
large_array
Expand Down